import java.util.*;
class Guess
{
public static void main(String[] args){
Random x=new Random();
int A=x.nextInt(101);
System.out.println("----------------猜数游戏----------------");
System.out.println("请输入一个数(0-100之间)");
Scanner num=new Scanner(System.in);
int number=num.nextInt();;
while(number!=A){
//number=num.nextInt();
if(A>number){
System.out.println("小了");
}
else if(A<number){
System.out.println("大了");
}
System.out.println("请再输入一个数");
number=num.nextInt();
}
System.out.println("答对了,找老师领取奖品");
}
} |
|