GuessNumber

import java.util.*;

public class GuessNumber {
    public static void main(String[] args) {
        int num = new Random().nextInt(100), temp;
        Scanner sc = new Scanner(System.in);
        while (true) {
            temp = sc.nextInt();
            if (temp < num) {
                System.out.println("太小了");
            } else if (temp > num) {
                System.out.println("太大了");
            } else
                System.out.println("猜对了");
        }
    }
}

原文地址:https://www.cnblogs.com/fantasy12436109/p/3971858.html