This should work.
It's not the most efficient, but it should be fairly easy to understand
Code:
// converting the integer stored in data[i] to the for AB in hex.
int temp = data[i];
char first, second;
int units = temp % 16; // Units now holds an integer 0 to 15, this is the B part
temp = temp-units;
temp = temp*0.1;
temp = temp % 16; // Temp now holds an integer 0 to 15, this is the A part
// Now convert the two integers to characters.
switch(units)
{
case 0: second = '0'; break;
case 1: second = '1'; break;
// Other cases go in between
case 9: second = '9'; break;
case 10: second = 'A'; break;
// More cases in here
case 15: second = 'F'; break;
}
switch(temp)
{
// Same as before but into first.
}
cout<<data[i]<<" is "<<first<<second<<" in hex.";
// Do some code to put first and second into your cstring.