當前位置:首頁 » 編程語言 » 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);
}

熱點內容
fst編程 發布:2025-10-18 11:14:10 瀏覽:937
訪問域的方法 發布:2025-10-18 11:09:08 瀏覽:395
c語言中取整符號 發布:2025-10-18 11:07:41 瀏覽:890
游戲文件編譯 發布:2025-10-18 10:53:55 瀏覽:863
安卓手機怎麼定時重啟 發布:2025-10-18 10:29:07 瀏覽:937
迭代演算法遞歸演算法 發布:2025-10-18 10:26:59 瀏覽:9
手機版我的世界伺服器能不能加模組 發布:2025-10-18 10:02:54 瀏覽:219
方舟生存進化ios怎麼和安卓一起玩 發布:2025-10-18 09:09:35 瀏覽:965
刷鞋解壓 發布:2025-10-18 09:07:26 瀏覽:980
筆記本插網口怎麼配置網路 發布:2025-10-18 08:57:50 瀏覽:137