Calculating the amount of calories to maintain weight

I have the basis of what needs to be put down to finish this problem but I already know some of it is horribly wrong. The part where I try to implement candym and candyf as well as bmrm and bmrf. Any advice would be greatly appreciated. The problem is :

The Harris-Benedict equation estimates the number of calories your body needs to maintain your weight if you do not exercise. This is called your basal metabolic rate, or BMR. The formula for the calories needed for a woman to maintain her weight is:
a. BMR = 655 + (4.3 x weight in pounds) + (4.7 x height in inches) – (4.7 x age in years)

The formula for the calories needed for a man to maintain his weight is:
b. BMR = 66 + (6.3 x weight in pounds) + (12.9 x height in inches) – (6.8 x age in years)

A typical chocolate bar will contain around 230 calories. Write a program that allows the user to input in the following order: his or her weight in pounds, height in inches, age in years, and the character M for male and F for female. The program should then output the number of chocolate bars that should be consumed to maintain one’s weight for the appropriate sex of the specified weight, height, and age. Allow the user to do this as many times as they wish.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
     int weight, height, age, candym, candyf, candy;
     string M, F, gender, bmrm, bmrf; 
     candy = 230;
     cout << "To calculate basal metabolic rate(BMR) enter the following: \n";
     cout << "Enter his or her weight in pounds: "; cin >> weight;
     cout << " Enter height in inches: "; cin >> height;
     cout << " Enter age in years: "; cin >> age;
     cout << " Enter M for male or F for female: "; cin >> gender;
     bmrf = 655 + (4.3 x weight) + (4.7 x height) - (4.7 x age);
     bmrm = 66 + (6.3 x weight) + (12.9 x height) - (6.8 x age);
     candyf = (bmrf / candy);
     candym = (bmrm / candy);
     if(gender == "M")
     {
         cout << "As a male you need to typically eat about " << candym 
                 << " candy bars to maintain your weight";
     }
     else if(gender == "F")
     {
         cout << "As a female you need to typically eat about " << candyf
                 << " candy bars to maintain your weight";
     }
     else 
     {
         cout << "Invalid input. ";
     }
     
I realized after posting this that I do need to use * instead of x. Other than that I am not sure what to do.
Can anyone give advice as to what I'm trying to do in line 11 and 12 in this code?
It's not correct I know that but I don't know any other way
Topic archived. No new replies allowed.