#includeint main() { int sex, sports, diet; double myheight=0, faheight, moheight; printf("请输入你的性别(男1/女0)n你父亲的身高n你母亲的身高n是否爱锻炼(是1/不是0)n是否有好的饮食习惯(有1/没有0)n"); scanf_s("%d%lf%lf%d%d", &sex, &faheight, &moheight, &sports, &diet); switch (sex) { case 1: { if (sports == 1 && diet == 1) myheight = (faheight + moheight) * 0.54 * 1.035; if (sports == 1 && diet == 0) myheight = (faheight + moheight) * 0.54 * 1.02; if (sports == 0 && diet == 1) myheight = (faheight + moheight) * 0.54 * 1.015; if (sports == 0 && diet == 0) myheight = (faheight + moheight) * 0.54; printf("你的身高可能是:%5.2f cm", myheight); break; } case 0: { if (sports == 1 && diet == 1) myheight = (faheight * 0.923 + moheight) / 2 * 1.035; if (sports == 1 && diet == 0) myheight = (faheight * 0.923 + moheight) / 2 * 1.02; if (sports == 0 && diet == 1) myheight = (faheight * 0.923 + moheight) / 2 * 1.015; if (sports == 0 && diet == 0) myheight = (faheight * 0.923 + moheight) / 2; printf("你的身高可能是:%5.2f cm", myheight); break; } } }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)