Question
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: (1) Start by printing instructions on the screen. (2) For every game (a) Prompt the user for minimum and maximum values. (b) Generate a random integer between these two values (inclusive). Be sure not to display this! (c) 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. (d) 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
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