Skip to content

Help pls

miki

Asked Dec 26, 2005, 10:40 PM EST2 answers
Share
LinkedInX
How do i reset a number after auto generating?

Guess game
eg. A user auto generated a number then pass it to a server to see if it matches the server's, if match server will regenerate another number for guessing. This is the time where my user generated number wont change when i requested for generating another number.

Please make a guess: 7000

Your guess is too large, try again!

Please make a guess: 2456

Congratulations, your guess is correct, well done!

A new number has been generated.

Please make a guess: A
Congratulations, your guess is correct, well done!<<<-- number doesnt change 
Please help

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0

    You must have somewhere in the code a try-catch -block that takes care of the string to number conversion, right? When you enter a non-number, the catch is executed; so reset the number in that catch block.

    0
  • 0

    wad do u mean by reset the number in the catch block? The auto generated number is by entering "a" or "A" then the server will generate a random number

    0