#include #include using namespace std; int Factorial(int n); bool AskUserToContinue(void); string MakeLower(string word); int main () { int i {4}; bool keepGoing {true}; while (keepGoing) { cout << i << "! = " << Factorial(i) << endl; keepGoing = AskUserToContinue(); } return 0; } bool AskUserToContinue(void){ string userResponse; bool doContinue; bool goodAnswer{false}; while(not goodAnswer) { cout <<"Do you wish to continue (yes, no) => "; cin >> userResponse; userResponse = MakeLower(userResponse); if (userResponse == "yes") { doContinue = true; goodAnswer = true; } else if (userResponse == "no") { doContinue = false; goodAnswer = true; } else { cout << "Please enter yes or no!" << endl; } } return doContinue; } int Factorial(int n){ int i; int returnValue{1}; for(i=2; i <= n; ++i) { returnValue *= i; } return returnValue; } string MakeLower(string word){ int i; for(i =0; i < word.size(); ++i) { word[i] = tolower(word[i]); } return word; }