Question
C++ (Guess number) Write a program that generates a random two-digit integer. The program prompts the user to predict the generated number by entering a
C++
(Guess number) Write a program that generates a random two-digit integer. The program prompts the user to predict the generated number by entering a two digit integer, and then determines the accuracy of the user's prediction according to the following rules:
a. If the user's prediction matches the generated number exactly, the accuracy is 100%.
b. If one digit is in the user's predicted number matches a digit in the generated number, the accuracy is 50%.
c. If none of the digits in user's predicted number matches with the generated number, the accuracy is 0%.
A. Sample run:
Generating number . . .
Enter your guess: 98
The generated number is: 98
Accuracy: 100%
Generating number . . .
Enter your guess: 89
The generated number is: 98
Accuracy: 100%
Generating number . . .
Enter your guess: 87
The generated number is: 98
Accuracy 50%
Generating number . . .
Enter your guess: 95
The generated number is: 98
Accuracy: 50%
Generating number . . .
Enter your guess: 75
The generated number is: 98
Accuracy: 0%
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started