新手,编了一个程序,运行的和编的不一样,求解
#include<stdio.h>main()
{
int fa, mo ;
float A, B, C;
char pe, op, ch;
printf("input mo and fa:\n");
scanf(" %d,%d", &mo, &fa);
printf("you are men ? T OR F :\n");
scanf("%c", &op);
switch (op)
{
case 'T':
A = (mo + fa)*0.54;
break;
case'F':
A = (fa*0.923) + mo;
break;
}
printf("是否喜爱运动y or n:\n");
scanf("%c", &pe);
switch (pe)
{
case'y':
B = A*0.02;
break;
case'n':
B = A;
break;
default:
printf("inour error");
}
printf("是否健康饮食Y or N:");
scanf("%c", &ch);
switch (ch)
{
case'Y':
C = B*0.015;
printf("%d", C);
break;
case'N':
C = B;
printf("%d", C);
break;
}
}
[此贴子已经被作者于2015-10-25 11:46编辑过]