#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char s; //孩子的性别
char sp; //是否喜欢体育运动
char d; //是否有良好的饮食习惯
float h; //我的身高
float fh; //父亲的身高
float mh; //母亲的身高
printf("Are you a boy(M) or a girl(F)?\n");
scanf(" %c",&s);
if (!(s=='m' || s=='M' || s=='f' || s=='F'))
printf("\nInput sex error!");
else
{
if(s=='m'||s=='M')
{
printf("Please input your father's height(cm):\n");
scanf(" %f",&fh);
printf("Please input your mother's height(cm):\n");
scanf(" %f",&mh);
h=(fh+mh)*0.54;
printf("Do you like sports(Y/N)?\n");
scanf(" %c",&sp);
if (!(sp=='y' || sp=='Y' || sp=='n' || sp=='N'))
{
printf("\nInput sports error!");
}
else
if (sp=='y' || sp=='Y')
{
h=1.02*h;
}
printf("Do you have a good habit of diet(Y/N)?\n");
scanf(" %c",&d);
if (!(d=='y' || d=='Y' || d=='n' || d=='N'))
{
printf("Input diet error!\n");
}
else
if (d=='y' || d=='Y')
{
h=h*1.015;
printf("Your future height will be %f(cm)\n",h);
}
}
else
{
if(s=='f'||s=='F')
printf("Please input your father's height(cm):\n");
scanf(" %f",&fh);
printf("Please input your mother's height(cm):\n");
scanf(" %f",&mh);
h=(fh*0.923+mh)/2;
printf("Do you like sports(Y/N)?\n");
scanf(" %c",&sp);
if (!(sp=='y' || sp=='Y' || sp=='n' || sp=='N'))
{
printf("\nInput sports error!");
}
else
if (sp=='y' || sp=='Y')
{
h=1.02*h;
}
printf("Do you have a good habit of diet(Y/N)?\n");
scanf(" %c",&d);
if (!(d=='y' || d=='Y' || d=='n' || d=='N'))
{
printf("Input diet error!\n");
}
else
if (d=='y' || d=='Y')
{
h=h*1.015;
printf("Your future height will be %f(cm)\n",h);
}
}
}
return 0;
}