*NOTE: there is a similar question on here but it did not help me because my friend straight up copy pasted it on to her code and I don't want to do that (plus it made in zero way any sense to me personally so why would I so much as refer to it in the first place if I don't follow the method used for it). I need some help with the LOGIC essentially, not even exactly the code written out line by line.
I have a function for my char to decimal already:
void CharToDec(char hexVal)
{
if(hexVal >= '0' && hexVal <= '9')
hexVal = hexVal - '0';
else
{
hexVal = hexVal - 'A' + 10;
}
}
Not sure if those lines are right but it's what I got from my professor. I need to get a decimal conversion from hexadecimal using recursion. No exception. Can anyone please give me a pseudo-code to follow or a logic stream for dummies? I'm not smart nor do I understand recursion at all. Professor skimmed and sincerely didn't sound interested at all in helping us deal with this. Plus we don't have a textbook. And since the whole school is closed due to the pandemic, I am having an extra hard time to reach out to him.
My base switch code has to be a different function that's recursive. I'm using this block of code just to convert the characters into decimals in the hex chain.
Example output:
Enter hex value: 7F
Decimal value: 127
Like so.
Thank you.