代码没有error,但运行时会出现照片上的问题,就是本来应该输入的,它直接跳了
程序代码:
include<stdio.h> int main() { char sports,diet,sex; float faHeight,moHeight,height; printf("请输入用户父亲及母亲身高:"); scanf("%f,%f",&faHeight,&moHeight); printf("请输入用户性别(男M,女F):"); scanf("%c",&sex); if(sex=='F') height=(faHeight*0.923+moHeight)/2; else if(sex=='M') height=(faHeight+moHeight)*0.54; printf("请输入用户是否有良好的饮食习惯(Y为良好,N为不良好):\n"); scanf("%c",&diet); if(diet=='Y') height=1.015*height; printf("请输入用户是否喜爱体育锻炼(Y为喜爱,N为不喜爱):"); scanf("%c",&sports); if(sports=='Y') height=height*1.002; printf("用户身高预测为:%fcm\n",height); return 0; }