- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- float height,weight,BMI;
- re:
- cout<<"請輸入您的身高(公尺):";
- cin>>height;
- if(height>=45)
- {
- cout<<"你是火星人嗎?"<<endl;
- goto re;
- }else if(height<0.6)
- {
- cout<<"爛"<<endl;
- goto re;
- }
- re2:
- cout<<"請輸入您的體重(公斤):";
- cin>>weight;
- if(weight>=350)
- {
- cout<<"動物"<<endl;
- goto re2;
- }else if(weight<=15)
- {
- cout<<"胖虎"<<endl;
- goto re2;
- }
- BMI=weight/(height*height);
- cout<<"您的BMI值為:"<<BMI<<endl<<"您的BMI分級為:";
- if(BMI<19.7)
- {
- cout<<"體重過輕!!"<<endl;
- }else if(BMI>=19.7&&BMI<24)
- {
- cout<<"正常!"<<endl;
- }else if(BMI>=24&&BMI<27)
- {
- cout<<"太重"<<endl;
- }else if(BMI>=17&&BMI<20)
- {
- cout<<"跟女朋友ㄘㄟˋ !"<<endl;
- }else if(BMI>=20&&BMI<25)
- {
- cout<<"處罰 一整年吃菜!"<<endl;
- }else
- {
- cout<<"重度肥胖!送醫院!"<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |