68 338
Assignments Done
98,8%
Successfully Done
In November 2018

Answer to Question #4952 in Action Script | Flash | Flex | ColdFusion for piyush

Question #4952
Write a short program that asks for your height in centimetres and then converts your height to feet and inches.
Expert's answer
#include <iostream>
int main()
{

const int convFeetoInches = 12;
const double convInchesToMeter = 0.0254;
const double convLBtoKG = 2.2;

using namespace std;
cout.setf(ios_base::fixed, ios_base::floatfield); // fixed-point

int feet = 0;
cout << "Enter your height [feet]: "; cin >> feet; cout << endl;
int inches = 0;
cout << "Enter your height [inches]: "; cin >> inches; cout << endl;
int weight = 0;
cout << "Enter your weight [pounds]: "; cin >> weight; cout << endl;

double heightM = (feet*convFeetoInches + inches)*convInchesToMeter;
double massKG = weight / convLBtoKG;
double BMI = massKG / (heightM*heightM);

cout << "Your BMI is " << BMI;

cin.get();
cin.get();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions