#include<stdio.h>
int main()
{
double faheight,moheight,sex,height,k1,k2,habit,EP;
printf("sex,faheight,moheight,k1,k2:\n");
scanf("%lf %lf %lf %lf %lf",&sex,&faheight,&moheight,&habit,&EP);
if(EP==1) k1=0.02; //喜欢体育运动
if(EP==0) k1=0;//不喜欢体育运动
if(habit==1) k2=0.015; //卫生习惯好
if(habit==0) k2=0;//卫生习惯差
if(sex==1) height=(faheight0.923+moheight)/2(1+k1)*(1+k2);//女
if(sex==2) height=(faheight+moheight)0.54(1+k1)*(1+k2);//男
printf("height=%lf",height);
return 0;
}
#include<stdio.h>
int main()
{
char r;
do
{
double faheight, moheight, sex, height, k1, k2, habit, EP;
printf("sex,faheight,moheight,k1,k2:\n");
scanf("%lf %lf %lf %lf %lf", &sex, &faheight, &moheight, &habit, &EP);
if (EP == 1) k1 = 0.02; //喜欢体育运动
if (EP == 0) k1 = 0;//不喜欢体育运动
if (habit == 1) k2 = 0.015; //卫生习惯好
if (habit == 0) k2 = 0;//卫生习惯差
if (sex == 1) height = (faheight * 0.923 + moheight) / (2 * (1 + k1)) * (1 + k2);//女
if (sex == 2) height = (faheight + moheight) / (0.54 * (1 + k1)) * (1 + k2);//男
printf("height=%lf", height);
printf("是否继续测量");
scanf("%c", &r);
} while (r=='y'||r=='Y');
return 0;
}