// Exercise 12.16: MultiplicationTeacher.cpp // This game asks the user to enter the product of two // randomly generated numbers in the range 0-9. #include // required to perform C++ stream I/O #include // contains prototype for function time // contains function prototypes for functions srand and rand #include using namespace std; // for accessing C++ Standard Library members // function prototypes int generateQuestion(); void generateOutput(); int generateQuestion (int one, int two) { return one * two; } // function main begins program execution int main() { // randomize random number generator using current time srand( time( 0 ) ); // define variables int userAnswer = 0; // stores the user's answer int correctAnswer=0; // stores the correct answer int one; int two; one=1+ rand() %10; two=1+ rand()% 10; correctAnswer=one*two; while (userAnswer != -1 ) { cout << "How much is " << one << " times " << two << " ( -1 to end )? "; cin >> userAnswer; if (userAnswer != correctAnswer && userAnswer != -1) { cout << "\nNo. Please try again ( -1 to end ) ?"<