So i am just starting out learning C ++ and i was trying to make a BMI calculator. When ever i run the program and it prints the BMI number its a weird number. Not one it should get. Please can u help me out with my source?
#include <iostream>
using namespace std;
int main(void)
{
int myweight;
int myheight;
int mynum;
mynum = 703;
int mybmi;
int squared;
cout << "Please enter your weight in pounds." << endl << endl;
cin >> myweight;
cout << "\nPlease enter your height in inches." <<endl << endl;
cin >> myheight;
cin.ignore();
squared = (myheight * myheight);
mybmi = ((myweight * mynum)/squared);
if (mybmi < 18.5) {
cout << "\nYour BMI is:" << mybmi << cout << "\tYour BMI says you are Underwight." << endl;
}
else if (mybmi >= 18.5) {
cout << "\nYour BMI is:" << mybmi << cout << "\tYour BMI says you are Normal." << endl;
}
else if (mybmi >= 25){
cout << "\nYour BMI is:" << mybmi << cout << "\tYour BMI says you are Overwight." << endl;
}
else if (mybmi >= 30){
cout << "\nYour BMI is:" << mybmi << cout << "\tYour BMI says you are Obese." << endl;
}
cin.get();
system("pause");
return 0;
}