Converting Binary to Decimal using strings

Posted 15 August 2012 - 11:00 AM

I've written a program that asks the user to input a number using strings, the program then will convert that number to decimal, however Im having a problem with it, when I compile (using -lm) and run the a.out, lets say I try to convert 11 to decimal it gives a huge number... not sure where I went wrong so would anyone help please?

Re: Converting Binary to Decimal using strings

Re: Converting Binary to Decimal using strings

Posted 15 August 2012 - 11:23 AM

derp that fixes everything.... thank you. Now this is a akward thing to ask but, how would I be able to convert the other way? from decimal to binary, im guessing I need a remainder and and a % but Im not really sure, any help?