package com.company;
import java.util.Scanner;
import java.util.Random;
public class Main
{
public static void main(String[] args)
{
Scanner reader = new Scanner(System.in);
Random random = new Random();
System.out.println("现在给你一个1-100之间的整数,请你猜猜这个数");
int realNumber = random.nextInt(100) + 1;
int yourguess = 0;
System.out.println("输入您的猜测");
yourguess = reader.nextInt();
while(yourguess != realNumber)
{
if(yourguess > realNumber)
{
System.out.println("猜大了,请重新输入你的猜测");
yourguess = reader.nextInt();
}
else
{
System.out.println("猜小了,请重新输入你的猜测");
yourguess = reader.nextInt();
}
}
System.out.println("恭喜你猜对啦~");
}
}