Re: Help
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Oct 2007 01:02:24 GMT
On Tue, 30 Oct 2007 16:11:36 -0000, f2prateek <f2prateek@xxxxxxxxx>
wrote, quoted or indirectly quoted someone who said :
I'm tryin to make a game in java which is like guessing the number.
eg:The number is 345 and the user enters lets say 123, so like the
program is supposed to return dat one digit was guessed correctly and
none were guessed correctly in their right positions. Can i get some
help please for the second part of the program. And also how i use the
random function to generate a different 3-duigit number.
Thanks a lot for your hep guys.
You want to be able to take a number apart into digits. This is very
similar to the task of converting it to a string.
In a loop both divide by 10 and take the remainder modulo 10. This
peels the digits off right to left.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- References:
- Help
- From: f2prateek
- Help
- Prev by Date: Re: how to convert metric to pixels
- Next by Date: Re: Help
- Previous by thread: Re: Help
- Next by thread: Re: Help
- Index(es):
Relevant Pages
|
|