#include<stdio.h>
int main()
{ char sex,sports,diet;
float height,moheight,faheight;
scanf ("性别:%c 父亲身高:%f 母亲身高:%f 是否喜欢运动:%*c%c 是否有良好饮食习惯:%c%c",&sex,&faheight,&moheight,&sports,&diet);
if (sex == 'M')
{
if (sports == 'Y' && diet == 'Y')
{
height = (faheight + moheight) * 0.54 * (1 + 0.035);
}
else if (sports == 'Y' && diet == 'N')
{
height = (faheight + moheight) * 0.54 * (1 + 0.02);
}
else if (sports == 'N' && diet == 'Y')
{
height = (faheight + moheight) * 0.54 * (1 + 0.015);
}
else if (sports == 'N' && moheight == 'N')
{
height = (faheight + moheight) * 0.54;
}
}
if (sex == 'W')
{
if (sports == 'Y' && diet == 'Y')
{
height=((faheight * 0.923 + moheight) / 2 ) (1 + 0.035);
}
else if (sports == 'Y' && diet == 'N')
{
height = ((faheight * 0.923 + moheight) / 2) * (1 + 0.02);
}
else if (sports == 'N' && diet == 'Y')
{
height = ((faheight * 0.923 + moheight) / 2) * (1 + 0.015);
}
else if (sports == 'N' && moheight == 'N')
{
height = ((faheight * 0.923 + moheight) / 2);
}
}
printf("你的身高:%.0fcm",height);
}
scanf ("性别:%c 父亲身高:%f 母亲身高:%f 是否喜欢运动:%*c%c 是否有良好饮食习惯:%c%c",&sex,&faheight,&moheight,&sports,&diet);
用法不对,改成这样:scanf ("%c%f%f%c%c",&sex,&faheight,&moheight,&sports,&diet);
提示语用 printf 输出