#include <iostream>
usingnamespace std; //included in every program
int main()
{
//Declare Variables
int height; //Height in inches (integer)
int age; //Age in years (integer)
double weight; //Weight in pounds (fractional part)
double bmr; //Basal Metabolic Rate (fractional part)
char gender;
char active_rate; //Male or Female (one character or symbol)
double new_bmr;
//Input
cout<< "Enter your weight in pounds\n";
cin>> weight; //weight in pounds
cout<< "Enter your height in inches\n";
cin>> height; //height in inches
cout<< "Enter your age in years\n";
cin>> age;
cout<< "Enter s if you are sedentary, "
<< "w if you are somewhat active, "
<< "a if you are active, "
<< "or h if you are highly active.\n";
cin>> active_rate;
cout<< "Enter m or f\n";
cin>> gender; //male or female
//Processing data
if (gender == 'm') //m for male
{
bmr = 66 + (6.3 * weight) + (12.9 * height) - (6.8 * age);
//equation for men
}
else (gender == 'f') //f for female
{
bmr = 655 + (4.3 * weight) + (4.7 * height) - (4.7 * age);
}
if (active_rate == 's')
(new_bmr = bmr * 1.20);
elseif (active_rate == 'w')
(new_bmr = bmr * 1.30);
elseif (active_rate == 'a')
(new_bmr = bmr * 1.40);
else (active_rate == 'h')
(new_bmr = bmr * 1.50);
if ((gender == 'm')||(gender == 'f'))
if ((active_rate == 's')||(active_rate == 'a')||(active_rate == 'w')||(active_rate == 'h'))
{
cout<< "Your bmr is " << new_bmr << " calories"<<endl;
//total bmr in calories
cout<< "Number of chocalate bars is equal to "<< (new_bmr/230)<<endl;
cout<< "\nThe program is over\n";
//the program has ended
}
else
cout<< "Error: Please try again\n";
}
#2: Don't paraphrase the errors. "Has to do with parenthesis I think" is not very informative. Post the actual error you're getting. I know the error message may seem like gibberish to you, but people here know how to read them.
#3: The error message will actually tell you exactly what line the error is on. Give us that line number. That makes it much easier to find the problem.
If I remember you only use else when you're assigning a default value with IF/ELSE. Instead you want to assign it based on "h" if that's why the user inputs.