#include // A course is made up of four modules, each scored out // of 25. The final course grade is the sum of the four // module grades and is therefore scored out of 100. // // A module is passed if the student receives at least // 13 out of 25. // // To pass the course, a student must satisfy BOTH of the // following requirements: // // 1. Pass at least three of the four modules. // // 2. Receive a final course grade of at least 50 // out of 100. // // Write a program that asks the user for the four module // grades and prints either // // Passed. // // or // // Failed. // // If any entered module grade is less than 0 or greater // than 25, immediately terminate the program by returning // 0 from main(). // Function declarations int main(); // Function definitions int main() { return 0; } // Hint: // // There are two separate requirements for passing the // course: // // final grade >= 50 // // AND // // at least three modules passed. // // You can calculate the final grade by adding the four // module grades. // // To determine how many modules were passed, create an // integer variable initially equal to zero: // // int pass_count{ 0 }; // // For each module with a grade of at least 13, increment // this variable. // Here is one solution: /* int main() { int module_1_grade{}; std::cout << "Enter your grade in module 1: "; std::cin >> module_1_grade; if ( (module_1_grade < 0) || (module_1_grade > 25) ) { return 0; } int module_2_grade{}; std::cout << "Enter your grade in module 2: "; std::cin >> module_2_grade; if ( (module_2_grade < 0) || (module_2_grade > 25) ) { return 0; } int module_3_grade{}; std::cout << "Enter your grade in module 3: "; std::cin >> module_3_grade; if ( (module_3_grade < 0) || (module_3_grade > 25) ) { return 0; } int module_4_grade{}; std::cout << "Enter your grade in module 4: "; std::cin >> module_4_grade; if ( (module_4_grade < 0) || (module_4_grade > 25) ) { return 0; } int final_grade{ module_1_grade + module_2_grade + module_3_grade + module_4_grade }; // There is no need to count the number of passed // modules if the final grade is already below 50. if ( final_grade < 50 ) { std::cout << "Failed." << std::endl; } else { int pass_count{ 0 }; if ( module_1_grade >= 13 ) { ++pass_count; } if ( module_2_grade >= 13 ) { ++pass_count; } if ( module_3_grade >= 13 ) { ++pass_count; } if ( module_4_grade >= 13 ) { ++pass_count; } if ( pass_count >= 3 ) { std::cout << "Passed." << std::endl; } else { std::cout << "Failed." << std::endl; } } return 0; } */