Question
D I AM ABLE TO RUNIT WITH OUT ERRORS> #include using namespace std; // Function to perform Warm-up exercise void performWarmUp(int warmUpReps) { cout <
D I AM ABLE TO RUNIT WITH OUT ERRORS>
#include
using namespace std;
// Function to perform Warm-up exercise
void performWarmUp(int warmUpReps) {
cout << "*** Warm-up Section ***" << endl;
for (int i = 1; i <= warmUpReps; i++) {
cout << "Warm-up repetition " << i <
" complete." << endl;
}
}
// Function to perform Cardio exercise
void performCardio(int cardioReps) {
cout << "*** Cardio Section ***" << endl;
for (int i = 1; i <= cardioReps; i++) {
cout << "Cardio repetition " << i << " complete." << endl;
}
}
// Function to perform Cool-down exercise
void performCoolDown(int coolDownReps) {
cout << "*** Cool-down Section ***" << endl;
for (int i = 1; i <= coolDownReps; i++) {
cout << "Cool-down repetition " << i << " complete." << endl;
}
}
int main() {
cout << "Fitness Routine" << endl;
char continueExercise = 'y';
do {
int warmUpReps, cardioReps, coolDownReps;
cout << "Enter the number of repetitions for Warm-up: ";
cin >> warmUpReps;
cout << "Enter the number of repetitions for Cardio: ";
cin >> cardioReps;
cout << "Enter the number of repetitions for Cool-down: ";
cin >> coolDownReps;
performWarmUp(warmUpReps);
cout << "Do you want to continue to the Cardio section? (y/n): ";
cin >> continueExercise;
if (continueExercise != 'y') {
cout << "Fitness routine completed. Goodbye!" << endl;
break;
}
performCardio(cardioReps);
cout << "Do you want to continue to the Cool-down section? (y/n): ";
cin >> continueExercise;
if (continueExercise != 'y') {
cout << "Fitness routine completed. Goodbye!" << endl;
break;
}
performCoolDown(coolDownReps);
cout << "Do you want to continue exercising? (y/n): ";
cin >> continueExercise;
} while (continueExercise == 'y');
cout << "Fitness routine completed. Goodbye!" << endl;
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Your C code defines a fitness routine program that allows users to input the number of repetitions f...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started