Something like this I imagine:
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
unsigned int hexToInt(char *str)
{
return (unsigned int)strtol(str, NULL, 16);
}
int intToHex(unsigned int num, char *buf)
{
return sprintf(buf, "%x", num);
}
int main(void)
{
char buf[256];
unsigned int num;
printf("Hex number: ");
fflush(stdout);
fgets(buf, sizeof(buf), stdin);
if(*buf && buf[strlen(buf)-1] == '\n')
buf[strlen(buf)-1] = '\0';
num = hexToInt(buf);
intToHex(num*10, buf);
printf("%s\n", buf);
return 0;
}
The whole meat of the program is in 3 bold lines. I mean how do you point someone in the right direction when there's so little to do? The project link explicitly states what's passed to and returned from each function and it looks like the conversion functions are already written out for you. Even reading in the user input is done for you. The only thing to know how to do is call a function.