Problem with functions

I need help figuring out what it is I did wrong with this program. Here is the code first.

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;
}

My problem is that regardless of the numbers I put in for age and beats per minute I still get the same numbers. 132 and 154 for the minimum and maximum respectively. For references the numbers I should be getting numbers like these:
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
Can anyone tell me what I did wrong here I have no idea?
The variables on lines 7 and 12 are not related.

Line 18 does not return two variables - instead, the comma operator causes only the second variable to be returned.

Global variables are bad practice - don't use them. A quick Google search will answer the "why" you may be asking.
ok thank you I know have a problem where the calculateMaximumHeartRate call in the main function isn't working and the displayTargetHeartRate isn't working either so if you have any advice there it would be greatly appreciated. Again though thank you for pointing out what was wrong to begin with.
Topic archived. No new replies allowed.