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 - The Fusion of Science and Community**

Dismiss Notice

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++

Loading...

Similar Threads - Decimal number whatever | Date |
---|---|

Java Applet, use of decimals | Feb 2, 2017 |

How do I make the decimal go on? | Oct 10, 2015 |

The number in more than 3 decimal places ? | Dec 4, 2010 |

Decimal number to floating-point represention? | Nov 25, 2009 |

Making a number to decimal form | Sep 29, 2008 |

**Physics Forums - The Fusion of Science and Community**