Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- bool targetHeartRate(int age, int beats)
- {
- double minRate = (220 - age)*0.6;
- double maxRate = (220 - age)*0.7;
- if (beats >= minRate && beats <= maxRate)
- return true;
- else
- return false;
- }
- void main12()
- {
- int age, beats;
- cout << "Enter your age: ";
- cin >> age;
- while (age < 0)
- {
- cout << "Enter a valid age: ";
- cin >> age;
- }
- cout << "Check and answer your beat per minute: ";
- cin >> beats;
- bool check = targetHeartRate(age, beats);
- if (check)
- cout << "You are in your target heartrate" << endl;
- else if (!check)
- cout << "Your are outside your target heartrate" << endl;
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement