C语言风格qwq

dreamer 发表于 8个月前 · 关联问题 预测身高

#include <stdio.h> int main() { char sex, F, M, Y, N; float fatherHeight, motherHeight, H; char sport, food; scanf("%c", &sex); scanf("%f %f", &fatherHeight, &motherHeight); getchar();//读走前面输入的回车 scanf("%c", &sport); getchar();//同理 scanf("%c", &food); if (sex == 'M') { H = (fatherHeight + motherHeight) * (0.54); } if (sex == 'F') { H = (fatherHeight * (0.923) + motherHeight) / 2; } if (sport == 'Y') { H *= (1.02); } if (food == 'Y') { H *= (1.015); } printf("%f", H); return 0; }