package cn.itcast.day04.demo01;
import java.util.Random;
import java.util.Scanner;
public class LittleGame {
public static void main(String[] args) {
Random r = new Random();
int randomNum = r.nextInt(100) + 1;
Scanner sc = new Scanner(System.in);
// int guessNum = sc.nextInt();
for (int i = 0; i < 12; i++)
{
System.out.println("请输入你猜测的数字:");
int guessNum = sc.nextInt();
if (guessNum < randomNum) {
System.out.println("你猜的数字小了");
} else if (guessNum > randomNum) {
System.out.println("你猜的数字大了");
} else {
System.out.println("恭喜你猜对了");
break;
}
}
System.out.println("笨蛋没机会了。");
}
}