qq_涵雨_jmEU57
2018-10-25 14:58
#include<stdio.h>
int main(void)
{
float Height;
float faHeight;
float moHeight;
char sex;
char sport;
char diet;
printf("Are you a boy(m) or a girl(f)\n");
scanf(" %c",&sex);
printf("please enter your father's height\n");
scanf("%f",&faHeight);
printf("please enter your mother's height\n");
scanf("%f",&moHeight);
if(sex=='f'||sex=='F')
{
Height=(faHeight+moHeight)*0.54;
}
else
{
Height=(faHeight*0.923+moHeight)/2;
}
printf("do you have a good diet(y/n)\n");
scanf(" %c",&diet);
if(diet=='y'||diet=='Y');
{
Height = Height*1.015;
}
printf("do you like sport(y/n)\n");
scanf(" %c",sport);
if(sport=='y'||sport=='Y')
{
Height = Height*1.02;
}
printf("your future Height will be %f\n",Height);
return 0;
}
倒数第7行,sport没有取地址。加一个&
C语言入门
926209 学习 · 20797 问题
相似问题