书上第二十五行代码
float son=(father+mother)*HEG;
我一直被报错无法运行
从昨天下午开始苦恼到现在
解决了
用了
double son=(father+mother)*HEG;
可以运行了 -。-
问题出在哪里啊
#include<stdio.h>
#define HEG 0.54
float height(float father,float mother);
int main()
{
float father;
float mother;
float son;
printf("请输入父亲的身高:\n");
scanf("%f",&father);
printf("请输入母亲身高:\n");
scanf("%f",&mother);
son=height(father,mother);
printf("预测儿子身高:");
printf("%.2f\n",son);
return 0;
}
float height(float father,float mother)
{
double son=(father+mother)*HEG;
return son;
}
#include<stdio.h>
#define HEG 0.54
float height(float father,float mother);
int main()
{
float father;
float mother;
float son;
printf("请输入父亲的身高:\n");
scanf("%f",&father);
printf("请输入母亲身高:\n");
scanf("%f",&mother);
son=height(father,mother);
printf("预测儿子身高:");
printf("%.2f\n",son);
return 0;
}
float height(float father,float mother)
{
float son=(father+mother)*HEG;
return son;
}
这个就被报错了