这个是示例
#include<stdio.h> /包含头文件/
#define HEG 0.54 /定义常量/
float height(float father,float mother); /函数声明/
int main() /主函数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;
}
下面是我写的
#include<stdio.h>
int main()
{
int fh;
int mh;
int result;
printf("请输入父亲身高\n");
scanf("%d",&fh);
printf("请输入母亲身高\n");
scanf("%d",&mh);
result=(fh+mh)*0.54;
printf("预测孩子身高是:");
printf("%d",result);
return 0;
}
我这个没用函数,怎么运行的时候直接跳步骤了?