3.2

#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++)