check if temp < 10
if ( temp < 10 ) { hexaDeciNum [ i ] = temp + 48 ; i ++ ; } else { hexaDeciNum [ i ] = temp + 55 ; i ++ ; } n = n / 16 ; } string hexCode = " " ; if ( i == 2 ) { hexCode . push_back ( hexaDeciNum [ 0 ] ) ; hexCode . push_back ( hexaDeciNum [ 1 ] ) ; } else if ( i == 1 ) { hexCode = "0" ; hexCode . push_back ( hexaDeciNum [ 0 ] ) ; } else if ( i == 0 ) hexCode = "00" ;