hi i want to make a program that spits out the binary equivalent of numbers from 0-10000. Any ideas how to get started.???
This is a discussion on decimal to binary conversion within the C Programming forums, part of the General Programming Boards category; hi i want to make a program that spits out the binary equivalent of numbers from 0-10000. Any ideas how ...
hi i want to make a program that spits out the binary equivalent of numbers from 0-10000. Any ideas how to get started.???
Sure, lots of ideas ;-)
Look into the bit-shift operators << and >> to move individual bits into a usable position (position 0 specifically) and the boolean operators & and | to isolate one bit.
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers
This question gets posted easily every week. Try searching for it.
Quzah.
Hope is the first step on the road to disappointment.
If you're not up to speed on bit shifting, you can use repeated integral division of the number divided by the Radix. For example, 150: 150 / 2 = 75 with a remainder of 0. The binary representation will come out in reverse order using the remainder values.
Hey WaltP.
I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P
One wonders which is a more confusing responseOriginally posted by ronin If you're not up to speed on bit shifting, you can use repeated integral division of the number divided by the Radix. For example, 150: 150 / 2 = 75 with a remainder of 0. The binary representation will come out in reverse order using the remainder values.
Hey back!!Hey WaltP.
Definition: Politics -- Latin, from
poly meaning many and
tics meaning blood sucking parasites
-- Tom Smothers