Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a Guess the Number game in Matlab. Matlab will think of a random number between 1 and 50, and ask you to guess it.

Create a Guess the Number game in Matlab. Matlab will think of a random number between 1 and 50, and ask you to guess it. Matlab will tell you if each guess is too high or too low. You will win if you can guess the number within six tries. This game will use random numbers, loops, and input from the user. This is how the game should look like when executed (input in bold are from the user, doesnt need to be bold in Matlab):

Hello! What is your name? Joe

Well, Joe, I am thinking of a number between 1 and 50.

Take a guess.

10

Your guess is too high.

Take a guess.

2

Your guess is too low.

Take a guess. 4

Good job, Joe! You guessed my number in 3 guesses!

Or

Hello! What is your name? Zac

Well, Zac, I am thinking of a number between 1 and 50.

Take a guess. 50 Your guess is too high. Take a guess. 2 Your guess is too low. Take a guess. 45 Your guess is too high. Take a guess. 15 Your guess is too low. Take a guess. 40 Your guess is too high. Take a guess. 30 Your guess is too low. Take a guess. 38 Boo! You took 7 guesses to guess my number I win!

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

Step: 3

blur-text-image

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

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 1 Lncs 13426

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124227, 978-3031124228

More Books

Students also viewed these Databases questions