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("猜对了"); } } }
时间: 2024-10-16 12:44:50