You are not storing your remainders anywhere.
It should look like this (your math):
5 ) 559
-----
5 ) 111 r 4
-----
5 ) 22 r 1
----
5 ) 4 r 2
---
0 r 4 = 4214 (base 5)
And then for the base 16 you are going to need something like this:
Code:
const char ccBaseChars[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
And then called like this:
Code:
ccBaseChars [Remainder];