我调试的时候输出的第三行和第四行是在一起的 而且总是在那里运行出错
#include <stdio.h>
int main()
{
double faHeight, moHeight, Height;
char sex, sports, diet;
printf("请输入你父亲的身高:");
scanf_s("%lf", &faHeight);
printf("请输入你母亲的身高:");
scanf_s("%lf", &moHeight);
printf("请确定你的性别(m为男,f为女):");
scanf_s("%c", &sex);
printf("请问你是否喜欢体育锻炼(Y为喜欢,N为不喜欢):");
scanf_s("%c", &sports);
printf("请问你是否有良好的饮食习惯(Y为喜欢,N为不喜欢):");
scanf_s("%c", &diet);
if (sex == 'm' || sex == 'M')
Height = (faHeight + moHeight)*0.54;
if (sex == 'f' || sex == 'F')
Height = (faHeight*0.923 + moHeight) / 2;
if (sports == 'Y') {
if (diet == 'Y')
Height = Height*1.035;
if (diet == 'N')
Height = Height*1.02;
}
if (sports == 'N') {
if (diet == 'Y')
Height = Height*1.015;
if (diet == 'N')
Height = Height*1.00;
}
printf("你的身高可能为:%lf cm\n", Height);
return 0;
}