c语言编辑

来源:百度知道 编辑:UC知道 时间:2024/09/24 12:01:20
#include <stdio.h>
float max(float x,float y,float z);
{if(x>y)z=x;
else z=y;
return z;}
main()
{float a,b,c;
scanf("%f,%f",&a.&b);
c=max(a,b);
printf("%f,%f,the max is %f\n",a,b,c);}
我写的这个那错了啊!~实在是检查不出来了!~谢谢帮忙!~

#include <stdio.h>
float max(float x,float y)
{
float z;
if(x>y)z=x;
else z=y;
return z;
}
void main()
{
float a,b,c;
scanf("%f,%f",&a,&b);
c=max(a,b);
printf("%f,%f,the max is %f\n",a,b,c);
}

1.5,2.6
1.500000,2.600000,the max is 2.600000
Press any key to continue

从这里看是不是scanf("%f,%f",&a.%b)这里出错了,&a.&b之间应该是逗号。

#include <stdio.h>
float max(float x,float y);
{
float z;
if(x>y)z=x;
else z=y;
return z;}
main()
{float a,b,c;
scanf("%f,%f",&a.&b);
c=max(a,b);
printf("%f,%f,the max is %f\n",a,b,c);}