Hello again. Before I begin I would like to offer my heartfelt gratitude to the DaniWeb community; this website truly is a wonderful resource for a new programmer such as myself, and the help and advice that I have received have been incredibly useful.

I am currently working on a script to convert a number input by the user from any base to any base up to and including base62. Basically I am writing an algorithm that will have the user input a number, the starting base, and the desired result base; the script will then convert the number input first to base10, and then to the desired result base. My question arises from the possibility of the starting or ending base being base10: if either of these is the case then I will need to basically skip one half or the other of the script. I am somewhat familiar with the pass function, and I am still tinkering with implementing it to accomplish this.

Once again I am not looking for an answer, but rather the thoughts and ideas of the more experienced members of this community. Thanks in advance.

I am guessing that you are first converting from base x to base 10 the base 10 to base y.

If that is the case I would make two functions, one to convert from base x to base 10 then another to convert from base 10 to base x, then I would use an if statment.

That's precisely what the algorithm will do. I suppose it could be as simple as using if statements to determine where in the script to start processing the conversion; I'll update this post with code tonight so that I can be more specific.

I've just recently started working on this very problem. I understand how to convert from any base below 10, but I have a hard time figuring out any base to any base below 62. I understand prompting the user for their input of which base to which base and the value converted. I do not understand how you can convert a number such as H49E in base 23 to base 10. The letters mixed with numbers confuses me. I know what numbers the letters represent, but do not know how to convert them and the digits to base 10. Do you read it in as a string or integer? Any advice would be appreciated. Thank you.

This article has been dead for over six months. Start a new discussion instead.