#include <stdio.h>
int main()
{
char sex,sports,diet;
float faHeight,moHeight,chilHeight;
printf("请输入您的性别,女性输F,男性输M:");
sex=getchar();
printf("请输入您父亲的身高(厘米)faHeight=,母亲的身高(厘米)moHeight=",faHeight,moHeight);
scanf("%f %f",&faHeight,&moHeight);
printf("您是否喜欢体育锻炼,“是”请输入Y,“不是”请输入N,%c\n");
sports=getchar();
printf("您的饮食习惯是否健康,“是”请输入Y,“不是”请输入N,%c\n");
diet=getchar();
if(sex=='M')
{
if(sports=='Y'&&diet=='Y')
{chilHeight=(faHeight+moHeight)*0.54*(1+0.02+0.015);
}
else if(sports=='Y'&&diet=='N')
{chilHeight=(faHeight+moHeight)*0.54*(1+0.02);
}
else if(sports=='N'&&diet=='Y')
{chilHeight=(faHeight+moHeight)*0.54*(1+0.015);
}
else if(sports=='N'&&diet=='N')
{chilHeight=(faHeight+moHeight)*0.54;
}
printf("您未来的身高chilHeight=%f\n",chilHeight);
}
else if(sex=='F')
{
if(sports=='Y'&&diet=='Y')
{chilHeight=((faHeight*0.923+moHeight)/2)*(1+0.02+0.015);
}
else if(sports=='Y'&&diet=='N')
{chilHeight=((faHeight*0.923+moHeight)/2)*(1+0.02);
}
else if(sports=='N'&&diet=='Y')
{chilHeight=((faHeight*0.923+moHeight)/2)*(1+0.015);
}
else if(sports=='N'&&diet=='N')
{chilHeight=((faHeight*0.923+moHeight)/2)*(1+0.02+0.015);
}
printf("您未来的身高chilHeight=%f\n",chilHeight);
}
return 0;
}
