Problem 3 math game solution

$14.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

Problem 3: (15 points) Write a complete program that can be used to generate a practice
math problem for a young student. The program should display two random numbers
between 1 and 200 to be added, similar to this:
42
+ 168
—–
The program pauses while the student works on the problem. When the student is ready
to check their answer, they can enter it under the problem.
42
+ 168
—–
210
After receiving the user’s answer, compare it to the correct value. If they are correct,
congratulate them and exit the program. If they are incorrect, display a message
indicating that the answer is incorrect and prompt them to try again. Continue to prompt
them ( in a loop) until they enter the correct value.
Note that your output should line up in columns as shown above. The input from the user,
however, does not have to align perfectly with the other numbers in the problem.
You should use a named constant for limiting the range of numbers returned by the
random number generator, and that named constant should contain all capital letters (and
possibly underscore).
One aspect of random numbers is that a computer doesn’t really generate “random”
numbers. It has an algorithm, a set of steps that it follows, to generate them. For this
reason, computer-generated random numbers are often referred to as “pseudo-random”.
Unfortunately, C++ generates the same pseudo-random numbers every time the program
is run, making this a somewhat useless tutor! We can, however, “seed” the random
number generator, but what value do we seed it with? If we seed it with the same value
every time (such as 123), we still get the same pseudo-random numbers every time.
What we need is a number, to use as a seed, that changes…
To make your program generate different values you have to do two things: 1) Add the
following line of code at the top of your file, along with your other include(s):
#include