package test;
import java.util.Random;
import java.util.Scanner;
public class TestGame {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
int r = new Random().nextInt(999999);
int count =0 ;
while(true){
System.out.println("猜数字游戏,请输入一个数0到999999,输入-1结束游戏:");
int i = sc.nextInt() ;
if(i==-1){
break ;
}
count ++ ;
if(i
System.out.println("你已经猜了"+count+"次");
}else if(i>r){
System.out.println("你猜大了。");
System.out.println("你已经猜了"+count+"次");
}else{
System.out.println("恭喜你大对了,但是没奖励!");
}
}
System.out.println("游戏结束");
}
}