| Author |
Need Help: Recursive Code -- > Loop
|
Wolfgang Obi
Ranch Hand
Joined: Dec 05, 2005
Posts: 134
|
|
Hello, I'm having problems with following code segments.... 'trying to make loop out of the first part...but something seems to be going wrong. can anyone see my mistake.....? thanks. ___________________________________________________________________ [ April 10, 2006: Message edited by: Wolfgang Obi ] [ April 10, 2006: Message edited by: Wolfgang Obi ] [ April 10, 2006: Message edited by: Wolfgang Obi ]
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
|
What does the schritt01 method do? It's not defined in the posted code.
|
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
|
 |
marc weber
Sheriff
Joined: Aug 31, 2004
Posts: 11343
|
|
Oh, I think I see. These methods are supposed to give a binary representation of the input int, right? And schritt01 basically concatenates a char to the output. If you add the following test code... ...and then run with a command line argument (for example, 1234567), you will see that recu03 does give the correct binary representation. However, iter03 is in reverse order and missing a digit. H:\Java>java Tester 1234567 100101101011010000111 100101101011010000111 11000010110101101001 <== REVERSED AND MISSING DIGIT That should suggest where the problem is.
|
 |
Wolfgang Obi
Ranch Hand
Joined: Dec 05, 2005
Posts: 134
|
|
|
thanks Marc!
|
 |
 |
|
|
subject: Need Help: Recursive Code -- > Loop
|
|
|