|
楼主 |
发表于 2004-6-3 15:51:43
|
显示全部楼层
可还是有问题:
#include <stdio.h>
float max(float a,float b)
{
if (a>b)
return a;
else return b;
}
main()
{
float a,b,c;
printf("Please input a and b:\n");
scanf("%f,%f",&a,&b);
printf("%f,%f\n",a,b);
if (a>b)
printf ("a=%f",a);
else
printf("b=%f",b);
printf("\n");
c = max(a,b);
printf("%d\n",c);
return 0;
}
$gcc -o max max.c
$./max
Please input a and b:
4,5
4.000000,5.000000
b=5.000000
0
$ |
|