Exercise 3.2
来源:互联网 发布:汉代疆域 知乎 编辑:程序博客网 时间:2024/04/28 10:19
#include<iostream>using namespace std;int main(){ const int rate_inch_foot = 12; const float rate_inch_meter = 0.0254; const float rate_pound_kg = 2.2; cout << "Enter the foot your height:___\b\b\b"; int foot,inch,pound; float meter,kg; cin >> foot; cout << "Enter the inch your height:___\b\b\b"; cin >> inch; cout << "Enter the your weight in pound:___\b\b\b"; cin >> pound; inch += foot * rate_inch_foot; cout << "Your height is " << inch << " inches." << endl; meter = inch * rate_inch_meter; kg = pound / rate_pound_kg; cout << "Your BMI is " << kg / meter / meter << endl; return 0;}