This application converts a number of base m to a number of base n (m and n are any valid bases ).
It is developed using C++.
Here is the input format for this application :
- base from which you want to convert
- if base is greater than 10,
- provide characters with their values
- number which is to be converted
- base in which you want to convert
- if base is greater than 10,
- provide characters with their values
- provide characters with their values
-
string numToDecimal(string num, int base) :
- this function converts the provided number into decimal number.
- it takes two arguments, first is the number as a string and the oter is base to be converted as an integer.
- after conversion, returns the decimal number as a string.
-
string numToBase(string num, int base) :
- this function converts the provided decimal number into a number of any base.
- it takes two arguments, first is the decimal number as a string and other is base in which we have to convert (as an integer).
- after conversion, returns the final number as a string.
6
345.34
16
A 10
B 11
C 12
D 13
E 14
F 15
Converting number in base 10:
(5* 6^0) + (4* 6^1) + (3* 6^2) + (3* 6^-1) + (4* 6^-2)
Number in base 10: 137.611111
Converting from base 10 to base 16:
Integer part of base 10 Number:
137/16, Remainder: 9
8/16, Remainder: 8
Fractional Part of base 10 number:
9.77778 * 16 ==> 9
12.4444 * 16 ==> 12
7.11066 * 16 ==> 7
1.7705 * 16 ==> 1
12.3279 * 16 ==> 12
5.24698 * 16 ==> 5
3.95162 * 16 ==> 3
Number in base 16: 89.9C71C53