Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USING C++ Program to modify: #include #include using namespace std; int main() { //declare variables needed int n,m,temp; srand(time(NULL)); //generate random number in range 1

image text in transcribed

USING C++

Program to modify:

#include  #include  using namespace std; int main() { //declare variables needed int n,m,temp; srand(time(NULL)); //generate random number in range 1 to 500 int min=1,max=500; n = (rand() % (max - min + 1)) + 1; m = (rand() % (max - min + 1)) + 1; cout>temp; // cout  Modify the program again so it displays a menu allowing the user to select an addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program. After the user has finished the math problem, the program should display the menu again. The process is repeated until user chooses to quit the program. Input Validation: If the user selects an item not on the menu, display an error message and display the menu again. Additional requirements for the range of two random numbers to be generated 1. In the case of subtraction, make sure the second number is smaller or equal to the first one using a while loop to validate. 2. In the case of multiplication, make the first number in the range of 1  100 and the second number in the range of 1-9. 3. In the case of division, since this is integer division (no remainder), generate a single digit divisor ( 1 ~9) and a number that is a multiple of the divisor. For example, num= divisor * (rand()% 50 +1) Input An option from the displayed menu and a number for the solution output The program will first display a menu and prompt the user to enter a choice from the menu. The program then will display two random numbers to be computed and prompt the user to enter an answer for the result of these two numbers and display a message according to user's answer. This process will be repeated until the user's choice is to quit. An Example of Test Runs The output of your program might look like this: Math Tutor Menu 1. Addition problem 2. Subtraction problem 3. Multiplication problem 4. Division problem 5. Quit this program Enter your choice (1-5): 1 104 73 288 Sorry, the correct answer is 177

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Was there an effort to involve the appropriate people?

Answered: 1 week ago