So I'm working on my final project, and I decided to create a BMI calculator.
As part of the requirements, I need to call a function into play. Below is what I have so far, but I am getting errors. I don't expect the solution, but could someone assist me by pointing me in the right direction.
The problem is that I am not calling the function into play correctly (for starters). How do I do that?
Thank you.
Sara
#include <iostream>
using namespace std;
int main()
{
int weight ; // weight in pounds
int height ; // height in inches
float BMI ; // Body Mass Index
bool DoItAgain ;
char Repeat ;
cout << " " << endl ;
cout << "Body Mass Index (BMI) Calculator" << endl ;
cout << " " << endl ;
cout << "Enter your weight in pounds. (please round to nearest whole number): " << endl ;
cin >> weight ;
cout << "Enter your height in inches. (please round to nearest whole number): " << endl ;
cin >> height ;
cout << "Your BMI is" BMI(weight, height) << endl ; This is where my first problem is.
if BMI < 18.5
cout << "You are underweight, and should considered gaining weight."
"Please contact your doctor to discuss your options" << endl ;
if BMI <= 24.9
cout << "Congratulations, you are a healthy weight."
"You should continue to maintain this weight" << endl ;
if BMI <= 29.9
cout << "You are over weight and should consider losing a little bit of weight." << endl ;
if BMI <= 39.9
cout << "You are obese and your weight could lead to serious health problems."
"Please contact your doctor to discuss diet and exercise." << endl ;
if BMI >= 40.0
cout << "You are severely obese and your weight may already be causing serious health complications."
"Please contact your doctor to dicuss significant weight-loss options." << endl ;
cout << "Would you like to enter a new height and weight? (Y or N): " << endl ;
cin >> Repeat ;
if Repeat = N
DoItAgain = false
return 0 ;
}
int BMI(weight, height)
{
int wgt_kg // weight in kilograms
int hgt_m // height in meters
wgt_kg = (weight * 0.454) // kilograms = pounds * 0.454
hgt_m = (height * 0.0254) // meters = inches * 0.0254)
BMI = (wgt_kg/(hgt_m^2)) // BMI = kilograms/(meters^2)
return 0 ;
}