#include<stdio.h>
int big(int a, int b)
{
int c = a;
if (b > c)
c = b;
return c;
}
void main(void)
{
int first, second, third, max;
printf("please input three number:");
scanf("%d,%d,%d", &first, &second, &third);
max = big(first, second);
max = (third,max);
〃为什么不能写成max = (max,third);
printf("%d,%d,%d中最大的数是:%d\n",first,second,third,max);
}
你之前max = (max,third);都没有调用big函数,所以不对改好了
#include<stdio.h>
int big(int a, int b)
{
if (a > b)
return a;
return b;
}
void main(void)
{
int first, second, third, max;
printf("please input three number:");
scanf("%d,%d,%d", &first, &second, &third);
max = big(first, second);
max = big(max,third);
printf("%d,%d,%d中最大的数是:%d\n",first,second,third,max);
}
可以交换啊,你交换了有什么问题吗?