[求助]一个简单的问题
#include "math.h"#include "stdio.h"
int main()
{float a,b,c,area,s;
scanf("%f,%f,%f",&a,&b,&c);
s=1.0/2*(a+b+c);
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("a=%f\n",a);
printf("b=%f\n",b);
printf("c=%f\n",c);
printf("s=%f\n",s);
printf("area=%f\n",area);
return;
}
运行是OK的,可是修改成下面的程序以后
#include "math.h"
#include "stdio.h"
int main()
{float a,b,c,area,s;
scanf("%f,%f,%f",&a,&b,&c);
s=1/2*(a+b+c);
area=sqrt(s*(s-a)*(s-b)*(s-c));
printf("a=%f\n",a);
printf("b=%f\n",b);
printf("c=%f\n",c);
printf("s=%f\n",s);
printf("area=%f\n",area);
return;
}
就输出s=0.000000
/运算含有需要2边的类型一样一说吗? 别笑话我,真不知道哦