hi i want to make a program that spits out the binary equivalent of numbers from 0-10000. Any ideas how to get started.???
Printable View
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.
This question gets posted easily every week. Try searching for it.
Quzah.
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.
One wonders which is a more confusing response :DQuote:
Originally 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!!Quote:
Hey WaltP.