import java.util.Random;
import java.util.Scanner;
public class testRandomGame {
public static void main(String[] args) {
Random r = new Random();
int luckNumber = r.nextInt(100)+1;//生成一个答案数字(1-100)
Scanner sc = new Scanner(System.in);
//死循环
while(true){
System.out.println("请输入一个1-100之间的整数");
int number = sc.nextInt();
if(number > luckNumber){
System.out.println("你输入的数字过大");
}else if(number < luckNumber){
System.out.println("你输入的数字过小");
}else{
System.out.println("恭喜你,猜中了");
break;
}
}
}
}