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

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!