I got the idea from Matt's guide where he explained the binary to ASCII deal on
here. This is a simlar concept, but going from a base-two number (binary) to a base ten number (decimal).
Normally when you count you start with 0 and work your way up until you hit 9, then it starts over again, such as
1 then 2, 3, 4 up until you hit 9, then it goes back down to
10,
11
13. The same is done with binary, only it goes from 0 to one, then it starts over again.
Let's go with counting, to make it easy, and just to make it simply to follow, we'll go with binary:decimal.
0:0
1:1
10:2
11:3
100:4
101:5
110:6
111:7
1000:8
1001:9
1010:10
The concept is fairly easy, especially in counting, but how do you go from decimal to binary? Well this is where you have to put your basic math skills to a use. Easiest thing is to draw a table. The table should start at 1, then keep multiplying by 2 until the last number is equal to, greater than the number in decimal, and should go from left to right. Here's an example for 10:
16 8 4 2 1
Now that you have a table, you start with the left number (the biggest one). If that number is bigger than the decimal, stick a 0 in there and move on, otherwise place a 1. Subtract that number from the original, and keep going until the number reaches 0. Let's go back to the table:
16 8 4 2 1
0
Original number: 10. Ignore it. Move on.
16 8 4 2 1
0 1
Original number: 10. Subtract 8. Move on.
16 8 4 2 1
0 1 0
New number: 2. Ignore it. Move on.
16 8 4 2 1
0 1 0 1
New number: 0. Fill the rest with 0's. You're done.
16 8 4 2 1
0 1 0 1 0
Any zeros in the begining you can ignore, so the outcome is
1010. Looking back at when we counted from 0 to 10 to double check, that is in fact correct.
Now to go from binary to decimal you do a fairly simiar thing. Let's take a longer number like 1011001. Now draw the same chart again.
64 32 16 8 4 2 1
1 0 1 1 0 0 1
All you do is add everyone you see a 1, and the total is that binary number converted to decimal. So let's go step-by-step again:
64+16=80
80+8=88
88+1=89
And you're done.
Here's a picture of what a table would look like because making the correct spacing without the ability to have the extra spaces needed is hard. I know it's not straight, deal with it.
http://img360.imageshack.us/img360/2729/binbq6.png