在学习C++的过程中做的练习。已经跑通。
#include <iostream>
int main()
{
using namespace std;
double feet, inch, pound;
const double change1 = 0.0254;
const double change2 = 2.2;
cout << "Enter your feet : ";
cin >> feet;
cout << "Enter your inch : ";
cin >> inch;
double shengao = (feet * 12 + inch) * change1;
cout << "Your height is : " << shengao << " meters. " << endl;
cout << "Enter your weight : ";
cin >> pound;
double zhongliang = pound / change2;
cout << "Your weight is "<< zhongliang << " kilograms. "<< endl;
cout << "Your BMI is: " << zhongliang / ( shengao * shengao ) << ' . ' << endl;
cin.get();
cin.get();
return 0;
}
网友评论