not entirely sure what I did but I changed the code a little and it works now.....except that it gives me the wrong numbers.
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
#include <iostream>
#include <iomanip>
using namespace std;
// global variables
int age, bpm; // bpm is short for beats per minute
// Your processTargetHeartRate function goes here
int processTargetHeartRate()
{
int age, bpm;
cout << "Enter your age: ";
cin >> age;
cout << "Enter your heart beats per minute: ";
cin >> bpm;
return age, bpm;
}
int calculateMaximumHeartRate(int age)
{
int maximumHeartRate;
return maximumHeartRate = 220 - age;
}
// Your displayTargetHeartRate function goes here
void displayTargetHeartRate(int MaximumHeartRate, int age)
{
int maximumHeartRate = calculateMaximumHeartRate(age);
double minimumTargetRate = maximumHeartRate * .6;
double maximumTargetRate = maximumHeartRate * .7;
cout << "Minimum target heart rate is " << minimumTargetRate << endl;
cout << "Maximum target heart rate is " << maximumTargetRate << endl;
}
int main()
{
processTargetHeartRate();
int maximumHeartRate = calculateMaximumHeartRate(age);
displayTargetHeartRate(maximumHeartRate, age);
return 0;
}
|
No matter what numbers I input I always get 132 and 154. What did I do wrong? if you want some examples the numbers I should be getting are as follows:
Enter your age: 21 [Enter]
Enter your heart beats per minute: 120 [Enter]
Minimum target heart rate is 119.4
Maximum target heart rate is 139.3
Enter your age: 25 [Enter]
Enter your heart beats per minute: 120 [Enter]
Minimum target heart rate is 117.0
Maximum target heart rate is 136.5
Enter your age: 33 [Enter]
Enter your heart beats per minute: 110 [Enter]
Minimum target heart rate is 112.2