Creating a program to convert hex to decimal is not difficult what-so-ever. Though, I'm unsure of how to convert a single hex character to decimal since I'm used to working in pairs. For instance 'FF' or '23'.
Just for a hint, here is how it works.
Step 1
Step 2Code:Take the value of first hex character Take an array and loop 16 times left shifting by four digits each time. Note: If you do happen upon a hex value that you entered, break the loop.If you would like for me to show a sample example, I can.Code:Take the value of the second hex character and add that to the previously obtained value. Do this 16 times also with a loop. Note: If you do happen upon a hex value that you entered, break the loop.
Edit: You could use scanf() or sprintf() to get the %x. If so, you can always view this thread.
If you have further questions, please feel free to ask.
- Stack Overflow