#include<stdio.h>
int main ()
{
char sex,sports,diet;
double faheight,moheight,height=0;
printf("请输入性别,男性为:M,女性为:F
:");
scanf("%c",&sex);
if(sex=='M')
{
printf("体育锻炼,喜爱:Y,不喜爱:N :");
fflush(stdin);
scanf("%c",&sports);
if(sports=='Y')
{
printf("饮食习惯,良好:Y,不好:N :");
fflush(stdin);
scanf("%c",&diet);
if(diet=='Y')
{
printf("父亲身高:,母亲身高:");
fflush(stdin);
scanf("%lf,%lf",&faheight,&moheight);
height=(faheight+moheight)*0.54*1.035;
}
else if(diet=='N')
{
printf("父亲身高:,母亲身高:");
fflush(stdin);
scanf("%lf,%lf",&faheight,&moheight);
height=(faheight+moheight)*0.54*1.02;
}
}
else if(sports=='N')
{
printf("父亲身高:,母亲身高:");
fflush(stdin);
scanf("%lf,%lf",&faheight,&moheight);
height=(faheight+moheight)*0.54;
}
}
else if(sex=='F')
{
printf("体育锻炼,喜爱:Y,不喜爱:N :");
fflush(stdin);
scanf("%c",&sports);
if(sports=='Y')
{
printf("饮食习惯,良好:Y,不好:N :");
fflush(stdin);
scanf("%c",&diet);
if(diet=='Y')
{
printf("父亲身高:,母亲身高:");
fflush(stdin);
scanf("%lf,%lf",&faheight,&moheight);
height=(faheight*0.923+moheight)*0.54*1.035;
}
else if(diet=='N')
{
printf("父亲身高:,母亲身高:");
fflush(stdin);
scanf("%lf,%lf",&faheight,&moheight);
height=(faheight*0.923+moheight)*0.54*1.02;
}
}
else if(sports=='N')
{
printf("父亲身高:,母亲身高:");
fflush(stdin);
scanf("%lf,%lf",&faheight,&moheight);
height=(faheight*0.923+moheight)*0.54;
}
}
printf("成人身高=%lf\n",height);
}