map for decimal to hexa , 0 - 9 are straightforward , alphabets a - f used for 10 to 15.
map < int , char > m ; char digit = '0' ; char c = ' a ' ; for ( int i = 0 ; i <= 15 ; i ++ ) { if ( i < 10 ) { m [ i ] = digit ++ ; } else { m [ i ] = c ++ ; } }