📄 guess_play.java
字号:
/**
* AWT Sample application
*
* @author
* @version 1.00 07/03/26
*
*/
public class Guess_play {
public static void main(String[] args) {
int i=(int)(Math.random()*1000),j=0,k;
System.out.println("How many times do you want to guess it?");
k=KeyInput.readInt();
System.out.println("So,you get"+" "+k+" "+"chances.Let's begin");
while(k>0){
j=KeyInput.readInt();
if(j>i){
k--;
System.out.println("It's big");}
else if(j<i){
k--;
System.out.println("It's small");}
else {
System.out.println("It's right");
break;
}
}
if(k==0)System.out.println("Sorry,you have no chance already");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -