📄 guess4.java
字号:
class Guess4{
public static void main(String args[])
throws java.io.IOException {
int i;
char num = '6' ;
do {
System.out.println("a number between 0 and 10.");
System.out.print("what it is: ");
// 读取一个非换行的字符
do {
i = System.in.read();
} while(i == '\n' | i == '\r');
// 从键盘上输入一个数字
if(i==num) System.out.println("you are talent");
else {
System.out.println("you are wrong");
if(i<num) System.out.println("the number you guess is low.");
else System.out.println("the number you guess is high.");
System.out.println("try it again!\n");
}
} while(i != num);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -