📄 caishugame.m
字号:
function canshugame()
clc;
disp('welcome to play guess number game!');
time = input('Input a number(You can setting the max time you want):');
if time > 10
disp('very easy!');
elseif time > 7
disp('it is normal!');
else
disp('very hard!')
end
b = fix(rand(1)*100);
while time > 0
a = input('Please input a number between 0-100: ');
if a > b
disp('the number your input is bigger!');
elseif a<b
disp('the number your input is smaller!');
elseif a==b
disp('You win!');
break;
else
disp('your input is not a number! Please input again!');
time = time + 1;
end
time = time - 1;
end
if time <= 0
disp('Your loss!');
end
reply = input('Do you want to play again? Y/N [Y]: ','s');
if (reply == 'Y')|(reply == 'y')
canshugame();
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -