How to code so that the person can not press enter to continue?
Show older comments
So i have this for loop with an if statement into it. I have a few questions in my code but you seem to be able to by pass getting the right answer when pressing enter.
How would you fix that ?
This is what i have so far.
pause
clc
for index = 1:1
disp('A = Yellow , B = White , C = Black')
z = input('What Colors Does The Pieces Go On? ','s');
if lower(z) ~= 'c'
fprintf('\n')
disp('False, Start Over!')
fprintf('\n')
disp('The Correct Answer Was Black!')
fprintf('\n')
fd1 = ['Your Final IQ Is ', num2str(md) ,'!'];
disp(fd1)
return
elseif lower(z) == 'c'
fprintf('\n')
disp('Correct!')
fprintf('\n')
md1 = md * 2;
dm1 = ['Your IQ At The Moment Is ', num2str(md1) ,'!'];
disp(dm1)
break
end
end
pause
clc
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!