Write a matlab script m-file to play a guessing game the

Assignment Help MATLAB Programming
Reference no: EM13626304

Write a MATLAB script M-file to play a guessing game. The user will try to guess a number between 1 and 100. Your program will guide them to the right answer. Sample play should look like this:

Enter a number between 1 and 100 --> 50

Guess lower!

Enter your next guess --> 25

Guess higher!

Enter your next guess --> 33

Guess lower!

Enter your next guess --> 28

Congratulations! You got it in 4 guesses

Use the input command to obtain the guesses from the user. Note that you will be keeping track of how many guesses the user makes until the right answer is guessed.

This command generates a random number between 1 and 100: randi(100)

Optional improvements:

• Giving a special message for getting it on the first try.

• Giving a warning or error message if the user enters a number that is not between 1-100.

• Giving a warning or error message if the user does not enter a higher or lower number as instructed.

Reference no: EM13626304

Questions Cloud

Refrigerant-134a is being transported at 1kgs through a : refrigerant-134a is being transported at .1kgs through a teflon tube of inside diameter di 25mm and outside diameter
Moreover the manufacturer believes the lifetime of the : suppose a car manufacturer believes its windscreen wipers will last on average for three years on their cars if driven
Write a function that accepts an array a as input and : write a function that accepts an array a as input and searches the contents of the array for elements in three
Consider a 2210 lb automobile clocked by law enforcement : consider a 2210 lb automobile clocked by law enforcement radar at a speed of 85.5 mph. if the position of the car is
Write a matlab script m-file to play a guessing game the : write a matlab script m-file to play a guessing game. the user will try to guess a number between 1 and 100. your
What is the uncertainity in the position of an electron : german physicist werner heisenberg related the uncertainity of an objects position triangle x to the uncertainity in
A heat engine accepts 200000 btu of heat from a source at : a heat engine accepts 200000 btu of heat from a source at 1500 r and rejects 100000 btu of heat to a sink at 600 r.
Suppose tarzan leaps from the top of a 60-m tall building : suppose tarzan leaps from the top of a 60-m tall building. if his initial speed is 24 ms and at an angle of 23 degrees
A refrigerant at -40degc flows inside a copper pipe inside : a refrigerant at -40degc flows inside a copper pipe inside diameter 3 cm outside diameter 3.4 cm with a convective

Reviews

Write a Review

MATLAB Programming Questions & Answers

  Finite difference method

Use the finite difference method to calculate the temperature at the point specified since it is easier.

  Determine the necessary shell temperature

In a shell-and-tube heat exchanger, one fluid passes through a central tube while another fluid flows through an outer shell in the opposite direction. The purpose is to heat the fluid passing through the central tube.

  Find the integral of a function at an arbitrary location

Write a Matlab function to perform numerical integration of a set of evenly spaced data points using the trapezoidal rule

  Compute the speed of single-stage planetary gear train

Write a MATLAB function [speed] = planetary (N, emesh, first, last, arm) that computes the speed of a given link in a single-stage planetary gear train.

  Calculate and plot the error in the numerical derivative

Write a program to calculate and plot the error in the numerical estimate of the derivative.

  Create the graph using matlab functions

Create the graph, which contains a piecewise function where a line exists in the first interval, a parabola in the second interval, and the sine function in the third interval.

  Develop a simulation program

Develop a simulation program

  Create a vector in matlab

Create a three dimensional diagram of function.

  Open a named pipe and to read data from the pipe

Open a named pipe and to read data from the pipe in matlab

  Write the commands that will create the matrix

Write the commands that will create the matrix.

  Lagrange interpolating polynomial of degree

Lagrange interpolating polynomial of degree

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd