Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write an m-file that will play the Guess My Number Game with the user. The program generates a random integer in a specified range, and

Write an m-file that will play the “Guess My Number Game” with the user. The program generates a random integer in a specified range, and the user (the player) has to guess the number. The program allows the user to play as many times as he/she would like; at the conclusion of each game, the program asks whether the player wants to play again. The basic algorithm is:

Start by printing instructions on the screen.

For every game

Prompt the user for minimum and maximum values.

Generate a random integer between these two values (inclusive). Be sure not to display this!

Prompt the user to guess the number. For each guess, the game tells the user whether their guess was too low, too high, or correct. If the user is incorrect, prompt for another guess.

When the user guesses the correct number? Clear the command window? Tell the user that they guessed the correct number? Display the total number of guesses for that game? Ask the user if they would like to play again. You can do this by prompting for an input, 1 for yes and 0 for no.

Step by Step Solution

3.39 Rating (155 Votes )

There are 3 Steps involved in it

Step: 1

fprintfYou will enter guesses to find a number I have selec... 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

Programming With Microsoft Visual Basic 2017

Authors: Diane Zak

8th Edition

1337102121, 9781337517058, 978-1337102124

More Books

Students also viewed these Programming questions

Question

=+What are the relative powers of suppliers? Buyers? Competitors?

Answered: 1 week ago