Question: Write a MatLab program in which the guessing game from below is modified to allow the user to guess up to 4 times. If
Write a MatLab program in which the guessing game from below is modified to allow the user to guess up to 4 times. If the number wasn't guessed correctly after the 4 tries, tell the user what the correct number was, then ask if they want to play again. Add the ability for the user to quit the program by inputting a "q" or a "0." At that point, print out the number of wins/losses of the game. Number guessing game. Write a program, guessing.m, that does the following: The computer generates a random integer between 1 and 20 (inclusive). The computer displays "I am thinking of a number between 1 and 20." It prompts the user to input a guess. While the guess is not equal to the computer's number, it tells the user whether the guess was too low or too high, and prompts for another guess. When the user guesses the right number, the computer congratulates the user and ends the game. (Hint: Use a while loop.) A run of the program (for which the user guessed 10 and 15 before correctly guessing 13) might look something like this: >> guessing I am thinking of a number between 1 and 20. Enter your guess: 10 Too low Enter your guess: 15 Too high Enter your guess: 13 Right!
Step by Step Solution
There are 3 Steps involved in it
Below is a MATLAB program that implements the modified number guessing game as per your requirements ... View full answer
Get step-by-step solutions from verified subject matter experts
