write a c++ program that repeatedly generate random multiplications to quiz the
ID: 3644724 • Letter: W
Question
write a c++ program that repeatedly generate random multiplications to quiz the user.Randomly generate the operands of a question, and compute the correct answer. Ask the user for
his/her answer, and compare it to the correct answer. If the user gets it right, increment the total
score. Display the score as a percentage: the total questions the user has gotten right out of the
total questions he/she has been asked. Continue generating questions as long as the user indicates
he/she would like to keep playing.
Sample Output:
5 * 5 = 25
Correct!
You've answered 1/1 correctly.
Your score is: 1
Do you want to continue? (y/n): y
4 * 1 = 3
Nope!
You've answered 1/2 correctly.
Your score is: 0.5
Do you want to continue? (y/n): n
Explanation / Answer
#include // Header for randomness #include // Header for time (used to seed random) #include // Header for general IO put using namespace std; int main() { bool done=false; while (!done) { srand(time(NULL)); // Seed random int CorrectAnswers=0,AnswersDone=0; while(1) { if (AnswersDone==10){break;} int Answer=0; int Num = rand()%10; // Get a random number between 0 and 10 int Num2 = rand()%10; // Get a random number between 0 and 10 coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.