import java.util.*;
class RandomDome
{
public static void main(String[] args)
{
Scanner s=new Scanner(System.in);
Random r=new Random();
int num1=(r.nextInt(99))+1;
while(true){
System.out.println("输入要猜的数字");
int num= s.nextInt();
if(num>num1){
System.out.println("你猜的数大了");
}else if(num<num1){
System.out.println("你猜的数小了");
}else{
System.out.println("你猜对了");
break;
}
}
}
}
|
|