### I need feedback/ comment on my work

Hi !! I recently graduated and went for an interview as a software engineer at a international company. They sent me an assignment as a final interview. I just need somebody to commonet on my answers before I submit my work.
Thnx

Question: Determine the expected results of ‘to’ for the following input data to ‘Function Y’ ?

unsigned char FunctionX(unsigned char val)
{
if ( val <= 9 )
return ( (0xF & val) + 48 );
else if( (val > 9) && (val <= 15) )
return ( (0xF & val) + 55 );
else
return ('?');
}

int FunctionY(unsigned char *from, unsigned char *to, int len)
{
unsigned char c;
int i = 0;
for (i=0; i<len; i++)
{
c = FunctionX((0xF & from[i]>>4));
to[2*i] = c;
c = FunctionX((0xF & from[i]));
to[(2*i)+1] = c;
}
return (i*2);
}

void Results2( unsigned char *to, int len)
{
cout <<"The hexadecimal intergers of to are : ";
for (int i=0; i<len; i++)
{

cout << hex << setfill('0') << setw(2) << int(to[i])<<','<<"\t";

}

cout <<"\n\nThe decimal intergers of to are : ";

for(int j=0; j<len; j++)
{
cout<< dec << setfill('0') << setw(2) << int(to[j])<<','<<"\t";
}
}
Int main ()
{
// EXERCISE 2#
unsigned char from[] = {0x91, 0x28, 0x73, 0x56};
// (decimal) from[] = {145, 40, 115, 86}
unsigned char to[] = {','};
cout<< "\n\nExercise 2#\n\n";
FunctionY(from,to,len);
Results1(to,len);
cout <<"\n\nThe result of FunctionY is: "<< setfill('0') << setw(2) <<int(FunctionY(from,to,len))<<"\t";

/* RESULTS 2#

Hex = 39,31,32,32
Dec = 57,49,50,50

*/
Return 0;
}
Well, it's an answer.

I don't think it's what they're looking for.
I don't see an answer .... ????
Topic archived. No new replies allowed.