# C++

This C++ programming language-related question will be answered using the visual studio application. This question can be answered in Visual Studio by a writer who has computer programming qualifications connected to C++.
Inquiry 1.

Write a program that continuously generates arbitrary multiplications to test the user and keep score.

Create the two multiplicands (for instance, 6 and 7) and determine the right response (42). After getting the user’s response, compare it to the right response. Increase the overall score if the user answers correctly. Display the score as a percentage, rounded to the nearest percentage (for example, 63%), and as a fraction (for example, 5/8 correct). As long as the user says they want to keep playing, the questions will keep coming up.

### Save your time - order a paper!

Get your paper written from scratch within the tight deadline. Our service is a reliable solution to all your troubles. Place an order on any task and we will take care of it. You won’t have to worry about the quality and deadlines

Order Paper Now

You must incorporate functions into your application as a restriction. Add at least these four features, which correspond to the provided prototypes:

1. The NewRandomNumber() function, which takes an integer n (for example, 10), and outputs a new random number between 2 and n. We don’t want to create queries that are as simple as 13 or 0x8, as they are.

n = int NewRandomNumber;

Use the cstdlib library’s rand() function in your code. A pseudo-random integer between 1 and 32767 is produced using rand(). To change this number into an integer between 2 and n, use the operators % and +.

2. A function called MakeQuestion() that generates the user’s query. This function should make two new random numbers by calling NewRandomNumber() twice, determine what the correct response is, and then return the two new random numbers along with it. For NewRandomNumber() to know what kind of numbers to generate, MakeQuestion() has to know about n. This function should use reference arguments because it has to return three values.

MakeQuestion = void (int n, int& a, int& b, int& atimesb);

3. The UserAnswerIsCorrect() function, which uses the two operands and the right response produced by MakeQuestion() and displays the query to the user via cout. It then gets the user’s response via cin and contrasts it with the appropriate response. It returns True if the user’s response is accurate. Otherwise, False is returned.

4. The PrintScore() function, which computes and displays the user’s score as a fraction and as a percentage, takes as input the total number of questions and the total number of questions the user has successfully answered.

The user should have the option to select their level of difficulty by entering a number at the start of the program. For instance, the computer should only provide questions up to 4 times 4 if the user types “4”. The program should provide questions up to 12 times 12 if the user enters “12”.

Important information from your software, like the created question, the user response, and the cumulative score, should also be recorded in a log file. This log shouldn’t duplicate every user interaction, but it should provide an exhaustive record of how the software was used. Additionally, this log file needs to be neatly formatted. For instance:

PROGRAM LOG FILE FOR QUIZ
Identifier: John Smith
8 Question Response Cumul. Score: Difficulty
============== ======== ==============
3 * 5 = 15 15 1/1 (100%)
8 * 2 = 16 16 2/2 (100%)
6 * 9 = 54 45 2/3 (66%)
SESSION END

Don’t forget to thoroughly test your application and document it in your log file. In your comments, explain why you chose the test cases you did.

BONUS: Find a random number seed and use it to ensure that the generated random numbers are unique each time the program is run.

PLUS BONUS To construct a timer to track how long it takes the user to respond to a question, learn about the clock() method in the ctime library (http://www.cplusplus.com/reference/ctime/clock/). Perhaps you want to insult the user if they wait too long and praise them for rapid responses. The user might have to respond in 10 seconds or less. Perhaps you want to show the user a countdown timer so they can see how much time is left. To check if the user is improving, you can wish to monitor the time in the log and compare it to the last time they saw the question. Be innovative.

SUPER AWESOME BONUS: Maintain a file with a list of users and their scores; whenever a user launches the software and inputs their name, check the file to determine if they have previously played. If they have, continue where they left off with their score.