c语言的一道题,画流程图,该程序用于计算小孩身高(画出流程图、粘贴代码和程序结果)
满意回答
#includevoid main(){ float hf,hm,h; char sex,sports,diet; printf("Please type in the sex(M/F):"); scanf("%c",&sex); printf("Please type in the height of father:"); scanf("%f",&hf); printf("Please type in the height of mother:"); scanf("%f",&hm); printf("Do sports(Y/N):"); getchar(); ; ; ; ; ; ; ; ; ; ;//没特别的意思,只是揭立消除回车键的影响 scanf("%c",&sports); printf("Have a diet(Y/N):"); getchar(); ; ; ; ; ; ; ; ; ; ; ;//没特别的意思,只是消除回车键残稼的影香眠悟响 scanf("%d",&diet); if('m'==sex |'M'==sex) h=(hf+hm)*0.54; else h=(hf*0.923+hm)/2; if(('y'==sports |'Y'==sports)&&('y'==diet |'Y'==diet)) h=(1+0.02+0.015)*h; else if('y'==sports |'Y'==sports) h=(1+0.02)*h; else if('y'==diet |'Y'==diet) h=(1+0.015)*h; else h=h; printf("The height of the boy is %f\n",h);}