- List item
依据父母身高,个人性别,习惯,锻炼情况预测身高
//预测你的未来高度
2.List item
3.List item
#include<stdio.h>
int main()
{
char sex, sports, diet;
float myheight, moheight, faheight;
printf("Are you female(F) or man(M)?");
scanf(" %c", &sex);
printf("Your morther's height(cm):");
scanf("%f", &moheight);
printf("Your father's height(cm):");
scanf("%f", &faheight);
printf("Do you like sports?(Y/N)");
scanf(" %c", &sports);
printf("Do you have a habit of diet?(Y/N)");
scanf(" %c", &diet);
if (sex == 'M' || sex == 'm') {
myheight = (faheight + moheight) * 0.54;
}
else
{
myheight = (faheight * 0.923 + moheight) / 2;
}
if (sports == 'Y' || sports == 'y')
{
myheight = myheight * (1 + 0.02);
}
if(diet=='Y'||diet=='y')
{
myheight = myheight * (1 + 0.015);
}
printf("Your future height will be %.0f(cm)\n", myheight);
}