import java.util.Random;
import java.util.Scanner;
public class Du {
public static void main(String[] args) {
int rightNum = new Random().nextInt(100) + 1;
Scanner scanner = new Scanner(System.in);
int input = 0;
do{
System.out.print("清猜数字(1-100)!");
input = scanner.nextInt();
if(input > rightNum){
System.out.println("猜大了!");
}else if(input < rightNum){
System.out.println("猜小了!");
}
}while(input != rightNum);
System.out.println("猜对了" + rightNum);
}
}
---------------