Machine knows nothing about numeral systems. They are for human perception of numbers.
You must only "translate" numbers when human-machine interaction happens:
- from human form to machine form on input (human >> machine)
- from machine form to human form on output (machine >> human)
Example of output:
short c = 10; // for you its "decimal ten" now,
// for machine is just a handful of bits
printf("d = %d\n", c); // you explicitly say here to output as decimal
printf("d = 0x%.4X", c); // you explicitly say here to output as hexadecimal
So instead of trying to translate inside of logic part of program, go down to output part and translate there.
Hope it helps!