#include
int main()
{
int max(int x,int y,int z);
int a,b,c,sum;
scanf("%d,%d,%d",&a,&b,&c);
sum=max(a,b,c);
printf("max=%d\n",sum);
return 0;
}
int max(int x,int y,int z)
{
int m;
if(x>y) m=x;
else m=y;
if(m>z)m=m;
else m=z;
return(m);
}
问题完美解决,手打,求采纳
polly@nowthen:~/test$ cat test.c
#include
static int max(const int, const int, const int);
int main(void)
{
int a = 3, b = 0, c = -4;
int m = max(a, b, c);
printf("max of three is %d\n", m);
return 0;
}
static int max(const int a, const int b, const int c)
{
return a>b?a>c?a:c:b>c?b:c;
}
polly@nowthen:~/test$ gcc -Wall test.c -o liu
polly@nowthen:~/test$ ./liu
max of three is 3
如图