Re: Binary to Hexadecimal Conversion
- From: Lew <lew@xxxxxxxxxxx>
- Date: Sat, 30 Dec 2006 10:35:37 -0500
lei wrote:
It's working now. Another problem:
Enter a number in binary: 10000011
Hexadecimal: 00000000000000000083
How can I remove the zeros?
A very good question!
Take yourself off the keyboard for a few minutes, maybe actually use a pen[cil] and paper to work through the inherent logic of the challenge.
Think along the lines of, "Hmm, what conditions pertain when a am preparing to output a '0' that would require me to display it? What conditions would allow me to suppress it?" (Hint: One of the conditions is that the numeral to display at the moment is '0'.)
Then detect those conditions in your code, and either emit or decline to emit the '0' as appropriate.
- Lew
.
- References:
- Binary to Hexadecimal Conversion
- From: lei
- Re: Binary to Hexadecimal Conversion
- From: Thomas Schodt
- Re: Binary to Hexadecimal Conversion
- From: lei
- Re: Binary to Hexadecimal Conversion
- From: lei
- Binary to Hexadecimal Conversion
- Prev by Date: Re: Binary to Hexadecimal Conversion
- Next by Date: Re: Exception thrown & Failure in loading T2 native library db2jcct2 while connecting to db2/400 through java
- Previous by thread: Re: Binary to Hexadecimal Conversion
- Next by thread: Failure in loading T2 native library db2jcct2
- Index(es):
Relevant Pages
|