Hey all, I am majoring in math and taking this c++ which I am having some trouble with. [Im into paper and pencils :grumpy: ](adsbygoogle = window.adsbygoogle || []).push({});

So my assignment is to have a number saved in a string then convert it from a string to an integer (have that done) and finally convert that number to a decimal number from whatever base the user inputs.

I am lost with the int-base to decimal.

I was thinking using BASE 2 and convert it which ever base.

Integer--> convert it to base 2-->user inputs base-->converst BASE 2-->BASE N

Ex.

read 6

convert that to base 2-->110 [4+2+0=6]

user wants base 2-->print 110

Im assuming there is an algorithm for converting between bases that I dont know about.

Any ideas on how to do this and additional help would be really appreciated!!

ty all!

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Decimal number from whatever base the user inputs c++

**Physics Forums | Science Articles, Homework Help, Discussion**