Number of game guesses
Import java. util. collections;
Public class GuessNum {
Public static void main (String [] args ){
Second s = new second (System. in); // accept the input (number of guesses)
Int user = 0; // number of user inputs (small)
Int user2 = 100; // number of user inputs (large)
Int no =-1; // The number of input records.
/* Generate a random number and give it to the user */
Double d = Math. random ();
Int guess = (int) (d * 100)/1;
/* Compare the number of user guesses with the number generated */
For (; no! = Guess ;){
System. out. println ("please input a number in" + user + "to" + user2 + "! ");
System. out. print ("please input a number which you guess :");
No = s. nextInt ();
If (no> guess ){
System. out. println ("too big! ");
User2 = no;
}
If (no <guess ){
System. out. println ("too small! ");
User = no;
}
}
System. out. println ("congratulation! ");
}
}