i keep hearing people ask how to convert bases. this is a farily simple thing. so i'm repeating a reply i just wrote. this should help all of those noobs.
this is a fairly simple procedure
what you need to do is understand how the bases work
well lets say the right most charicter (number) of any base is 0
so we number them like so
7 6 5 4 3 2 1 0
now lets say we have a base 2 number
1 0 1 1 0 0 1 1 (8 digits seperated)
well now for the formula to convert the number
(the ^ charicter means raise to the power of. you will need to use the pow() function in math.h to do this, or multipy the first number by it's self the number of times of the second. in the case where the second number is 0 the answer is always 1) [note: Fractional powers are teh same as roots, and negitive powers produce imangonary numbers. both of which are beyond the scope of this text and will not be disgused here]
1*2^7 + 0*2^6 + 1*2^5 + 1*2^4 + 0*2^3 + 0*2^2 + 1*2^1 + 1*2^0
well you should be able to see the patterin. to make it a bit more apperent lets say n is your current digit the formula is <digit>*<base>^n
so all you have to do is add all of the digits together. this will work for any base.
base 16 (C in hex (base 16) has the value of 12)
C4 = C*16^1 + 4*16^0 = 196
now that you understand the basics you should be able to write a simple loop to convert any base to base 10. this formula applys to any base even extrodinarly high bases like base 1000 (i doubt you will ever use a base this high but it's nice to know how)
if you have any questions just ask
Not to say knowing these equations is pointless but...
you can do itoa which has a radix (the base you want) and you can just put itoa(Integer,CharArrayForResult,BaseYouWant);
BaseYouWant would be like 2, 8, 10, 16, etc.
then if you wanted, convert it back with Integer = atoi(CharArrayForResult);
that was not the point ;) trust me he knows all that him self
atoi is handy, but the knowledge behind what it does is important to understand. After all, everything in the computer is base 2 to begin with and somehow finds its way to base 10.