Re: Help



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
.



Relevant Pages

  • Re: How to convert extra long strings into their equivalent Hex Strings in VBA (Word 2K)
    ... numbers (upto 18 digits max) into its equivalent Hex String ... Public Function ExpressServiceCode(ByVal ServiceTag As String) As String ... 'the number dblTemp in the specified base, ... Dim lngTemp As Long ...
    (microsoft.public.vb.general.discussion)
  • Re: BigNum -- Floating Point
    ... The 'N' is the number of decimal digits. ... The internal representation is really just a string of bits. ... the number of shifts for various multiples of ten: ... The 'exponent' is very closely related to ...
    (comp.programming)
  • Re: Required Field for 7 Numeric digits only
    ... Function IsNumber(ByVal Value As String) As Boolean ... > works with verifying that it has 7 digits and is a numeric filled> textbox ... > Private Sub TextBox1_KeyPress ... > Dim IsValid As Boolean ...
    (microsoft.public.excel.programming)
  • Re: Cantors diagonal proof wrong?
    ... Infinity is not an integer, ... just a string of digits, ... >possible to prove anything by contradiction. ...
    (sci.math)
  • Re: MAX-FLOAT-DIGITS
    ... a usable string when flag2=false ... ... There is no easy way to determine the maximum number of usable digits ... If u is greater than zero the character string shall consist ... consist of MAX-FLOAT-DIGITS graphic characters left-justified ...
    (comp.lang.forth)