#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; //返回整型0
}
float height(float father, float mother)//定义计算儿子身高的函数
{
float son = (father + mother)*HEG; //具体计算儿子的身高
return sun; //返回儿子身高
}