为什么c语言的程序没有输出结果???

我的代码是这样子的。。。
#include <stdio.h>
int main()
{
char sex,sports,diet;
double faHeight,moHeight;
while(scanf("%s %lf %lf %s %s",&sex,&faHeight,&moHeight,&sports,&diet)!=EOF)
{
if (sex=='F')
{
if(sports=='Y'&&diet=='Y')
printf("%.2lf\n",(faHeight*0.923+moHeight)/2*1.02*1.015);
else if(sports=='Y'&&diet=='N')
printf("%.2lf\n",(faHeight*0.923+moHeight)/2*1.02);
else if(sports=='N'&&diet=='Y')
printf("%.2lf\n",(faHeight*0.923+moHeight)/2*1.015);
else if(sports=='N'&&diet=='N')
printf("%.2lf\n",(faHeight*0.923+moHeight)/2);
}
else if(sex=='M')
{
if(sports=='Y'&&diet=='Y')
printf("%.2lf\n",(faHeight+moHeight)*0.54*1.02*1.015);
else if(sports=='Y'&&diet=='N')
printf("%.2lf\n",(faHeight+moHeight)*0.54*1.02);
else if(sports=='N'&&diet=='Y')
printf("%.2lf\n",(faHeight+moHeight)*0.54*1.015);
else if(sports=='N'&&diet=='N')
printf("%.2lf\n",(faHeight+moHeight)*0.54);
}
}

}

第1个回答  2020-01-04
你的程序没有任何输出语句(cout或printf等)
当然不会有输出结果的
这个要看你想要输出什么,然后写相应的程序才可以
第2个回答  2016-10-01
输入单字符 用 %c接收!!!
while(scanf("%c %lf %lf %c %c",&sex,&faHeight,&moHeight,&sports,&diet)!=EOF)本回答被提问者和网友采纳
相似回答