Question: Task 5.3 Use the rand function to produce two positive one-digit integers (0 includes). The program should then prompt the user with a question, such

 Task 5.3 Use the rand function to produce two positive one-digit

Task 5.3 Use the rand function to produce two positive one-digit integers (0 includes). The program should then prompt the user with a question, such as How much is 2 +3? The user then inputs the answer (Enter -1 to stop). Next, the program checks the user's answer. If it's correct, the program should randomly display any of the following messages 1. Very good! 2. Excellent! 3. Nice work! 4. Keep up the good work! and ask another addition question If the answer is wrong, randomly display any of the following messages 1. No. Please try again. 2. Wrong. Try once more. 3. Don't give up! 4. No. Keep trying and let the user try the same question repeatedly until the user finally gets it right. A separate function should be used to generate each new question. This function should be called once when the application begins execution and each time the user answers the question correctly. (Hint: Use random-number generation to choose a number from 1 to 4 that will be used to select one of the four appropriate responses to each correct or incorrect answer. Use a switch statement to issue the responses.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!