Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions

Question

3. An overview of the key behaviors is presented.

Answered: 1 week ago

Question

2. The model is credible to the trainees.

Answered: 1 week ago