//This program is used to calculate the BMI of a person
//and display whether the person is overweight or not
//BMI = weight*703/height^2
//weight is measured in pounds/lbs
//height is measured in inches
#include <iostream>
#include <iomanip>
usingnamespace std;
int main()
{
double weight, height;
float BMI;
cout<<"Enter your weight in pounds: "<<endl;
cin>>weight;
cout<<"Enter your height in inches: "<<endl;
cin>>height;
BMI = (weight*703)/(height*height);
cout<<fixed<<showpoint<<setprecision(1);
cout<<"Your BMI is "<<BMI<<endl;
if (BMI<18.5)
{
cout<<"You are underweight. Eat more food, your too skinny!\n"<<endl;
}
elseif ((BMI<18.5) && (BMI>25))
{
cout<<"You have optimal weight. You are healthy, well done!\n"<<endl;
}
elseif (BMI>25)
{
cout<<"You are overweight. Stop eating so much junkfood and excercise!\n"<<endl;
}
system("pause");
return 0;
}
It only displays the first half of the code and completely skips over the if and else if statements for some reason.