该楼层疑似违规已被系统折叠隐藏此楼查看此楼
#include
#include
int main()
{
char sex,sports,diet;
float faHeight,moHeight,Height;
printf("请输入父亲身高\n,请输入母亲身高\n,请输入性别\n");
scanf("%f%f%c",&faHeight,&moHeight,&sex);
switch(sex)
{
case'F':Height=(faHeight+moHeight)*054;printf("%f\n",Height);break;
case'M':Height=(faHeight*0.923+moHeight)/2;printf("%f\n",Height);break;
default:printf("enter data error!\n");
}
printf("%f\n",Height);
scanf("%c%c\n",&diet,&sports);
printf("请输入是否健康饮食,请输入是否适当运动");
switch(diet)
{
case'Y':Height=Height*1.015;printf("%f\n",Height);break;
case'N':printf("%f\n",Height);break;
default:printf("enter data error!\n");
}
printf("%f\n",Height);
switch(sports)
{
case'Y':Height=Height*1.02;;printf("%f\n",Height);break;
case'N':printf("%f\n",Height);break;
default:printf("enter data error!\n");
}
return 0;
}
点赞
一键三连
C