package com.sf._04_random;

import java.util.Random;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        //1 创建出来一个1-100 随机数
        Random random = new Random();
        //0-99   1-100
        int randomNumber = random.nextInt(100) + 1;
        Scanner scanner = new Scanner(System.in);

        while (true){
            System.out.println("请输入要猜测数字");
            int number = scanner.nextInt();
            if(number > randomNumber){
                System.out.println("猜大了");
            }else if(number < randomNumber){
                System.out.println("猜小了");
            }else{
                System.out.println("恭喜你猜对了");
                break;
            }
        }
    }
}
