程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> 編程綜合問答 >> printf-大一新生求解哪錯了orz,大神快到碗裡來

printf-大一新生求解哪錯了orz,大神快到碗裡來

編輯:編程綜合問答
大一新生求解哪錯了orz,大神快到碗裡來

#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");              ????
claysystem
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved