Call by value help

Definitely not done with the code yet, but I seem to be stuck and unsure on how to exactly use call by value. Any and all help is much appreciated!

The program should calculate the person's Basal Metabolic Rate - the number of calories per day a person's body needs to function. Then, on the basis of calculated BMR, your program should output how many doughnuts a person can consume. A medium-size doughnut contains 251 calories.

The BMR formula is as follows:
for women: 655 + (4.3 x weight in pounds) + (4.7 x height in inches) - (4.7 x age in years) for men: 66 + (6.3 x weight in pounds) + (12.9 x height in inches) - (6.8 x age in years)

Depending on gender, BMR should be calculated by functions bmrWomen() and bmrMen() that both accept three parameters: "weight in pounds", "height in inches" and "age in years" and return the BMR. Note that the BMR has a fractional part.

The main function should prompt the user for her gender, weight, height and age; compute the BMR and the number of doughnuts that can be consumed per day; and then output both the BMR and the number doughnuts.

The number of doughnuts is: BMR divided by the number of calories in a doughnut. Fractional number of doughnuts can be dropped. The number of calories per doughnut (251) should be put in a named constant.

On the basis of the user's gender, main() function should decide whether to invoke bmrWomen() or bmrMen(). The user should input her height in feet and inches. The main() function should compute the total number of inches (one foot has 12 inches) and pass it to the bmr functions.



#include <iostream>
#include <cmath>

using namespace std;

int weight, age, gender;
double height, bmrMen(), bmrWomen();

int main()
{
cout << "Please enter your gender. To enter your gender, press 1 for male and 2 for female." << endl;
cin >> gender;
cout << "What is your age?" << endl;
cin >> age;
cout "What is your weight in pounds?" << endl;
cin >> weight;
cout << "What is your height in feet and inches?" << endl;
cin >> height;
closed account (o3hC5Di1)
Hi there,

Could you please provide the full code as well as the actual problems you are having?
Does the code compile? If not, which errors do you get?
If the code compiles, but the program crashes, when does the program crash and with which errors?

That will help us to help you better.

Thanks,
NwN
Well the problem is, I don't know where to go from there. After that code, I get lost. Not sure if anyone can offer any help with what I have, but it would be much appreciated if so.
Topic archived. No new replies allowed.