返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     float height,weight,BMI;
  7.     re:
  8.     cout<<"請輸入您的身高(公尺):";
  9.     cin>>height;
  10.     if(height>=30)
  11.     {
  12.         cout<<"請問巨人先生 你吃什麼長那麼高"<<endl;
  13.         goto re;
  14.     }else if(height<0.3)
  15.     {
  16.         cout<<"矮胖子BJ4"<<endl;  
  17.         goto re;
  18.     }
  19.     re2:
  20.     cout<<"請輸入您的體重(公斤):";
  21.     cin>>weight;
  22.     if(weight>=300)
  23.     {
  24.         cout<<"原來是頭豬壓"<<endl;
  25.         goto re2;  
  26.     }else if(weight<=10)
  27.     {
  28.         cout<<"你還活著嗎 都看到骨頭了"<<endl;
  29.         goto re2;  
  30.     }
  31.     BMI=weight/(height*height);
  32.     cout<<"您的BMI值為:"<<BMI<<endl<<"您的BMI分級為:";
  33.     if(BMI<18.5)
  34.     {
  35.         cout<<"體重過輕!!太瘦了啦 都變成受了XD"<<endl;
  36.     }else if(BMI>=18.5&&BMI<24)
  37.     {
  38.         cout<<"正常範圍!!要繼續保持唷M_<"<<endl;  
  39.     }else if(BMI>=24&&BMI<27)
  40.     {
  41.         cout<<"體重過重!!去去去去減肥"<<endl;  
  42.     }else if(BMI>=27&&BMI<30)
  43.     {
  44.         cout<<"體重過胖 你不是要交女朋友?"<<endl;   
  45.     }else if(BMI>=30&&BMI<35)
  46.     {
  47.         cout<<"體重超胖 你不要交女朋友了 其實男的也不錯 (##"<<endl;
  48.     }else
  49.     {
  50.         cout<<"體重爆炸!?恭喜你爆炸囉"<<endl;
  51.     }
  52.     system("pause");
  53.     return 0;
  54. }
複製代碼

TOP

返回列表