0
How to make a program for converting numbers from one number system to another?Please!
5 Respostas
+ 2
Please specify which language in Relevant Tags to clarify scope of the question.
I would suggest you to search the Code Playground for 'base converter' search keyword, other people had done that, and you can learn from their code, how it is done.
+ 2
Please edit your original question above, and put C++ into the Relevant Tags section. I already did search Code Playground with 'base converter' keyword before I suggested you, and I found many codes in search result.
+ 1
Which programming language do you prefer?
One approach which will work in almost any language is to use integer for the value and an array for digits.
To convert from decimal simply make a loop with modulo operator. To read input in different number system use a loop with multiplication of the exponent inside.
If you use c++ you can use itoa to convert integers to string with arbitrary base.
https://code.sololearn.com/cyxQuRD4u0WP/?ref=app
+ 1
This is mine in Javascript
https://code.sololearn.com/WjjO1O2ZHIvd/?ref=app
0
I should write this progrem on C++ and i can't find codes of other people