It easiest to store the binary numbers as a c string so you easily iterate through the digits:
1 2 3 4 5 6 7 8 9 10 11 12
int size = 8;
char * bitStr = "10100100"; // 8 bits
char dumStr[4];
char hexStr[size/4];
int i;
for (i = size - 1; i > 0; i -= 4)
{
// copy 4 bits starting from i and 3 bits to the left into a dumStr
// match the bit string sequence to its corresponding HEX character
}
Hint: look at the member functions for the CString.
Now, what does the algorithm say, starting from the least significant bit, move in steps of 4 bits, and "translate" each arrangement of 4 bits into a HEX character. By translate, you need to use a case statement.