0

This is the program that I made

```
// Chapter 5, Programming Challenge 8: Math Tutor
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
int num1, // The first random number
num2, // The second random number
choice, // The user's choice of problem
studentAnswer, // The student's answer
correctAnswer; // The correct answer
// Seed the random number generator.
srand(time(0));
do
{ // Display the menu and get a choice.
cout << "\tMath Tutor Menu\n";
cout << "------------------------------\n";
cout << "1. Addition problem\n";
cout << "2. Subtraction problem\n";
cout << "3. Multiplication problem\n";
cout << "4. Division problem\n";
cout << "5. Quit this program\n";
cout << "------------------------------\n";
cout << "Enter your choice (1-5): ";
cin >> choice;
// Validate the choice.
while (choice < 1 || choice > 5)
{
cout << "The valid choices are 1, 2, 3, "
<< "4, and 5. Please choose: ";
cin >> choice;
}
// Produce a problem.
switch (choice)
{
case 1: // Addition problem
// Generate two random numbers in
// the range 1 - 500.
num1 = 1 + rand() % 500;
num2 = 1 + rand() % 500;
// Calculate the correct answer.
correctAnswer = num1 + num2;
// Display the problem.
cout << "\n\n";
cout << " " << setw(4) << num1 << endl;
cout << " +" << setw(4) << num2 << endl;
cout << " " << "----" << endl;
cout << " ";
break;
case 2: // Subtraction problem
// Generate two random numbers in
// the range 1 - 999.
num1 = 1 + rand() % 999;
num2 = 1 + rand() % 999;
// Make sure num2 <= num1...
while (num2 > num1)
num2 = 1 + rand() % 999;
// Get the correct answer.
correctAnswer = num1 - num2;
// Display the problem.
cout << "\n\n";
cout << " " << setw(4) << num1 << endl;
cout << " -" << setw(4) << num2 << endl;
cout << " " << "----" << endl;
cout << " ";
break;
case 3: // Multiplication problem
// Generate two random numbers. The first in
// the range 1 - 100, the second in the
// range 1 - 9.
num1 = 1 + rand() % 100;
num2 = 1 + rand() % 9;
// Calculate the correct answer.
correctAnswer = num1 * num2;
// Display the problem.
cout << "\n\n";
cout << " " << setw(4) << num1 << endl;
cout << " *" << setw(4) << num2 << endl;
cout << " " << "----" << endl;
cout << " ";
break;
case 4: // Division problem with no remainder
// Generate a single digit divisor.
num2 = 1 + rand() % 9;
// Generate a number that is a multiple
// of num2...
num1 = num2 * (rand() % 50 + 1);
// Calculate the correct answer.
correctAnswer = num1 / num2;
// Display the problem.
cout << "\n\n";
cout << " " << num1 << " / " << num2 << " = ";
break;
case 5: // The user chose to quit the program.
cout << "Thank you for using Math Tutor.\n\n";
break;
}
// If student selected a problem, get and evaluate the answer.
if (choice >= 1 && choice <= 4)
{
cin >> studentAnswer;
if (studentAnswer == correctAnswer)
cout << "\n\nCongratulations! That's right.\n\n";
else
cout << "\n\nSorry, the correct answer is " << correctAnswer
<< ".\n\n";
}
} while (choice != 5); // Loop again if student did not choose to quit.
return 0;
}
```

The assignment is to modify it so these things are included:

Here is the instruction for my assignment

- Gives instructions
- Displays previous user’s name and score from file
- Prompts for the current user’s name
- Provides a menu of math choices (e.g., +. -, *, /), plus exit
- Asks users how many questions they want to answer
- Asks user for highest number to use
- Displays appropriate math questions with random numbers
- Keeps track of right and wrong answers
- Provide at least 10 randomly chosen correct and incorrect answers for feedback
- Gives feedback on how many questions answered and percent right for that group
- Returns to menu for possible additional problems
- When exit chosen shows grand total statistics – correct, attempted, and percent right
- Writes name and results to file
- When running again displays name and results of last person to use the program
- Break program into appropriate functions
- Write and use data validation functions in a private library of your creation that includes generic functions for getString, getInt, and getFloat.

I don't know what to do and I'm compeletely lost.