#include
#include
int main
{
double hieght,weight,BMI;
printf("please enter your hight(m) and weight(kg):");
scanf("%4.9lf,%4.9lf",&height,&weight);
BMI=weight/pow(height,2);
if(BIM printf("%ls","you are too thin!eat more!");
else if (BMI>=18.5&&BMI<=24.99)
printf("%ls","congratulation!you are prefectly normal!");
if(BIM>=25&&BIM<=28)
printf("%ls","be careful ,you are overweight now");
else (BMI>=28&&BMI<=32)?printf("%ls","you are too fat,watch out"):printf("%ls","Warning:It is danger to be this FAT!" );
return 0;
}
错误代码main.c|4|error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token|
#include
#include
#include
int main ()
{
double height,weight,BMI;
printf("please enter your hight(m) and weight(kg):");
scanf("%4.9lf,%4.9lf",&height,&weight);
BMI=weight/pow(height,2);//宽度/高度的平方
if(BMI)
printf("%ls you are too thin!eat more!",BMI);
else if (BMI>=18.5&&BMI<=24.99)
printf("%ls congratulation!you are prefectly normal!",BMI);
if(BMI>=25&&BMI<=28)
printf("%ls be careful ,you are overweight now",BMI);
else (BMI>=28&&BMI<=32)?printf("%ls you are too fat,watch out",BMI):printf("%ls Warning:It is danger to be this FAT!",BMI);
return 0;
}
我随便改了下你程序中的错误 现在能正确运行了 不过输出什么 我一直写的是BMI 你看着改 不明白 你这样写是什么意思
printf("%ls","you are too fat,watch out"); ????
if(BIM printf("%ls","you are too thin!eat more!");
这行没看懂
BIM是个变量 怎么写if()小括号里面了 而且还把printf写()里面了 你应该写漏还是?
printf语句 光有一个%ls 在,后面应该有个变量
而且变量 BMI 在程序中被使用 一会变成BIM一会编程BMI 这个就应该是错误其中最多的原因了
还有 hieght 变量 在程序中也是各种变化 建议把变量名改为height
请根据报错修改相应变量,然后按F10单步调试~
if(BIM printf("%ls","you are too thin!eat more!");
这行明显错了,,我猜你可能是想if(BMI<18.5)printf("%ls","you are too thin!eat more!");
太谢谢你们了,我会好好看的