how would i convert a number of one base into the same number in a different base for example how would i get a 10 in base of 4 to the 4 it is in a base of 10?
Printable View
how would i convert a number of one base into the same number in a different base for example how would i get a 10 in base of 4 to the 4 it is in a base of 10?
What do you mean, "base"?
well, our number system is in a base of ten it only has ten possible digits in a base of four it goes 0,1,2,3,10 using only four digits. i need to know how to convert them
So, what are the four digits of the 4 based system?
_itoa() will convert an integer to a string and allows you to specify the base, or you could do something like -
int a= 5;
int base = 4;
int b = a/base*10 + a%base;
//b will contain 11 in this case