A_Zguessinggame - end if getnum< cnum disp'That is too...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 2/24/11 % change guessing game: want to guess a random number between 'a' and 'z' % clear clc c num = round (rand (1)*25+97); cnum = char(num); r = 'yes'; while strcmpi('yes',r) % while this is true. .. continue getnum = input('Guess a letter between a and z:\n','s'); getnum = getnum + 32;
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end if getnum < cnum disp ('That is too low'); elseif getnum > cnum disp ('That is too high'); else disp ('Correct!'); break end r = input('Do you want to guess again yes or no? ', 's'); end if getnum ~= cnum fprintf ('You lose! The letter was %s.', cnum) end...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online