USING C Write program that creates a BM calculator applicati
USING C++
Write program that creates a BM! calculator application. This application should read the user wight in pounds and height in inches. Then calucualte and display the users body mass index. When compiled the program should also display the information from the Department of Health and Human Services in order to determing and evaluate their BMI:
BMI Values
Underwieght: less than 18.5
Normal: between 18.50 and 24.9
Overwieight: between 25 and 29.9
Obese: 30 or greater
For referenece: BMI = wieght in poinds x 703 / height in inches x height in inches
Solution
C++ code:
#include<iostream>
 #include<iomanip>
 using namespace std;
int main()
{
 unsigned int wgt;
 unsigned int hgt;
 float bmi;
 char choice=\'Y\';
   
 while (choice == \'Y\' || choice == \'y\' )
 {
 cout<<\"\ \ Please enter your weight (poinds): \";
 cin>>wgt;
 cout<<\"\ \ Please enter your height (inches): \";
 cin>>hgt;
 bmi = (wgt*703)/ (hgt*hgt*1.00);
 cout<<\"\ \";
 cout<<fixed<<showpoint<<setprecision(2);
 cout<<\"Your BMI is \"<<bmi<<endl;
   
 if (bmi < 18.5)
 cout<<\"Underweight!\"<<endl;
 else if (bmi >= 18.50 && bmi <24.9)   
     cout<<\"Normal!\"<<endl;
 else if (bmi >= 25 && bmi <29.9)
     cout<<\"Overweight!\"<<endl;
 else
     cout<<\"Obese\"<<endl;
 
 cout<<\"Do you want to continue?(Y/N) \";
 cin>>choice;
 }
 return 0;
   
 }
Output:

