0

How to make a program for converting numbers from one number system to another?Please!

25th Oct 2019, 4:34 AM
gerasimus 2002
6 odpowiedzi
+ 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.
25th Oct 2019, 5:46 AM
Ipang
+ 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.
25th Oct 2019, 5:53 AM
Ipang
+ 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
25th Oct 2019, 5:51 AM
Victor
26th Oct 2019, 10:06 AM
Makzo
Makzo - avatar
0
I should write this progrem on C++ and i can't find codes of other people
25th Oct 2019, 5:49 AM
gerasimus 2002