当前位置:首页 » 编程语言 » mooc答案c语言

mooc答案c语言

发布时间: 2023-09-11 17:28:26

Ⅰ 中国大学moocc语言程序设计苏小红课程实验题为什么总是显示结果错误

#include <stdio.h>
main()
{
char sex,sports,diet;
float faHeight,moHeight,yourHeight;
printf("sex F or M: , fatherHeight and motherHeight: ,
Whether like sports Y or N: , Whether have good diet Y or N:\n");
scanf("%c,%f,%f,%c,%c",sex,faHeight,moHeight,sports,diet);
if (sex=='F'){
if (sports=='Y'){
if (diet=='Y'){
yourHeight=(faHeight*0.923+moHeight)*0.54*1.02*1.15;
}
else{
yourHeight=(faHeight*0.923+moHeight)*0.54*1.02;
}
}
else{
if (diet=='Y'){
yourHeight=(faHeight*0.923+moHeight)*0.54*1.15;
}
else{
yourHeight=(faHeight*0.923+moHeight)*0.54;
}
}
}
else {
if (sports=='Y'){
if (diet=='Y'){
yourHeight=(faHeight+moHeight)*0.5*1.02*1.15;
}
else{
yourHeight=(faHeight+moHeight)*0.5*1.02;
}
}
else{
if (diet=='Y'){
yourHeight=(faHeight+moHeight)*0.5*1.15;
}
else{
yourHeight=(faHeight+moHeight)*0.5;
yourHeight=(faHeight+moHeight)*0.5;
}
}
}
printf("yourHeight is %f cm",yourHeight);
}

热点内容
访问域的方法 发布:2025-10-18 11:09:08 浏览:394
c语言中取整符号 发布:2025-10-18 11:07:41 浏览:889
游戏文件编译 发布:2025-10-18 10:53:55 浏览:862
安卓手机怎么定时重启 发布:2025-10-18 10:29:07 浏览:936
迭代算法递归算法 发布:2025-10-18 10:26:59 浏览:8
手机版我的世界服务器能不能加模组 发布:2025-10-18 10:02:54 浏览:218
方舟生存进化ios怎么和安卓一起玩 发布:2025-10-18 09:09:35 浏览:964
刷鞋解压 发布:2025-10-18 09:07:26 浏览:979
笔记本插网口怎么配置网络 发布:2025-10-18 08:57:50 浏览:136
怎么区分安卓机硬盘大小 发布:2025-10-18 08:53:26 浏览:815