您的位置:首页 > 编程语言 > C语言/C++

3.2

2015-10-27 16:48 387 查看
#include<iostream>

int main()
{
using namespace std;

const int Inch_to_foot = 12;//1英尺=12英寸
const double Foot_to_meter = 0.0254;//1英寸=0.0254米
const double Pound_to_kilogram = 2.2;//1磅=2.2千克

double foot,weight;
int inch;
cout << "Please enter your height and weight:\n";
cout << "So your height is--\n inches : ";
cin >> inch;
cout << " feet : ";
cin >> foot;
cout << "and weights is : ";
cin >> weight;
double meter_height = inch*Inch_to_foot*Foot_to_meter+foot*Foot_to_meter;
double kilogram_weight = weight*Pound_to_kilogram;
double BMI = kilogram_weight / (meter_height*meter_height);
cout << "Wow~! Your BMI is " << BMI << " !\n";
cout << meter_height<<endl;
cout << kilogram_weight;

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c++