- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- float height,weight,BMI;
- re:
- cout<<"請輸入您的身高(公尺):";
- cin>>height;
- if(height>=199)
- {
- cout<<"你是巨人"<<endl;
- goto re;
- re2:
- cout<<"請輸入您的體重(公斤):";
- cin>>weight;
- if(weight>=50)
- {
- cout<<"還好!!!"<<endl;
- goto re2;
- }else if(weight<=3)
- {
- cout<<"你是垃圾帶"<<endl;
- goto re2;
- }
- BMI=weight/(height*height);
- cout<<"您的BMI值為:"<<BMI<<endl<<"您的BMI分級為:";
- if(BMI<200.3)
- {
- cout<<"體重輕?!再豬一點!"<<endl;
- }else if(BMI>=18.5&&BMI<21)
- {
- cout<<"正常範圍!!鎮定!"<<endl;
- }else if(BMI>=24&&BMI<26)
- {
- cout<<"過重!!要減肥?"<<endl;
- }else if(BMI>=27&&BMI<32)
- {
- cout<<"輕度肥胖!!!進不了門 還好啦!"<<endl;
- }else if(BMI>=30&&BMI<35)
- {
-
-
-
- }
- system("pause");
- return 0;
- }
複製代碼 |