I have an assigment where I am to create a program to calculate BMI. I wrote the program and would like to have someone check it to see if there are any mistakes I need to correct.
//Declare variables
double weight, height, bmi = 0;
//Prompt user for weight in pounds
cout << "Please enter your weight in pounds:";
cin >> weight;
//Prompt user for height in inches
cout << "Please enter your height in inches:";
cin >> height;
//Display weight and height back to the user
cout << "This is the weight that you have entered:" << weight << endl;
cout << "This is the height that you have entered:" << height << endl;
//Calculate BMI of user
bmi = ( weight * 703 ) / ( height * height );
//Display the BMI to user
cout << "Your BMI is: " << bmi << endl;
//Display the descriptive word that corresponds to their BMI value
//If bmi is less than 18.5 classify as underweight
if ( bmi < 18.5 )
cout << "You are classified as underweight." << endl;
//If bmi is 18.5 or greater, but less than 25 then classify as normal
else if ( bmi >= 18.5 && bmi < 25 )
cout << "You are classified as normal." << endl;
//If bmi is 25 or greater, but less than 30 then classify as overweight
else if ( bmi >= 25 && bmi < 30 )
cout << "Your are classified as overweight." << endl;
//If bmi is 30 or greater then classify as obese
else if ( bmi >= 30 )
cout << "You are classified as obese."<< endl;
return 0;
I have used 'build' and 'debug' on visual basic studio to check and it works but I would like another check for it since it is a project grade.