萌新再次求教
c语言吧
全部回复
仅看楼主
level 3
pydd💨 楼主
#include<stdio.h>
int main()
{
float faHeight,moHeight,a,b;
char sex,sports,diet;
int c;
printf("Are you a boy(M) or a girl(F)?");
scanf("%c",&sex);
switch(sex)
{
case'M':
printf("Please input your father's height(cm):");
scanf("%f",&faHeight);
printf("Please input your mother's height(cm):");
scanf("%f",&moHeight);
a=(faHeight + moHeight) * 0.54 ;
break;
case'F':
printf("Please input your father's height(cm):");
scanf("%f",&faHeight);
printf("Please input your mother's height(cm):");
scanf("%f",&moHeight);
a=(faHeight * 0.923 + moHeight) / 2;
break;
}
printf("Do you like sports(Y/N)?");
scanf("%c",&sports);
switch(sports)
{
case'Y':
a=a*1.02;
break;
case'N':
a=a*1.00;
break;
}
printf("Do you have a good habit of diet(Y/N)?");
scanf("%c",&diet);
switch(diet)
{
case'Y':
a=a*1.015;
break;
case'N':
a=a*1.0;
break;
}
printf("Your future height will be %.0f (cm)",a);
return 0;
}
为什么会跳过啊?
2018年11月22日 09点11分 1
1