- 学·问
- 帖子详情
身高预测
太难了啊
发表于2020年11月13日
<p>#include <stdio.h></p><p>int main(int argc, char *argv[])</p><p>{</p><p> double fatherheight;</p><p> double motherheight;</p><p> double boyheight;</p><p> double girlheight;</p><p> char sex;</p><p> printf("请输入父亲身高和母亲身高,输入格式为:?,?\n");</p><p> scanf("%lf%lf",&fatherheight,&motherheight);</p><p> getwchar();</p><p> printf("输入孩子性别m为男孩f为女孩\n");</p><p> scanf("%c",&sex);</p><p> //printf("%d",sex);</p><p> if(sex=='m'){</p><p> boyheight = (fatherheight + motherheight)*1.08/2;</p><p> printf("男孩身高:%.2f\n",boyheight);</p><p> }</p><p> if(sex=='f'){</p><p> girlheight = (fatherheight + 0.923*motherheight)/2;</p><p> printf("女孩身高:%.2f\n",girlheight);</p><p> } </p><p> return 0;</p><p>}</p><p><br ></p>
1
回复