Okay, so I have an assignment, and I have been breaking my head for days can't figure it out.
The idea is to creat a program that reads numbers from a file, hexadecimal, and converts them into decimal, adds them and prints the decimal sum of the numbers.
Can't figure out how to read the hexadecimal number and actually do something with them. I tried reading them into a char array, seperated by commas, or by new lines, and I can't figure out what to do to read them and convert them into decimal.
This is pretty much what I got right now in a nutshell, a lot of trial and error , have no idea.
Could you please guide me towards the right direction or explain how can I read them so I can add them into a decimal value?
Thanks in advance.
Do I have to ue the std::hex
While I do the math? I mean, I can get the Value "2F1" into an integer, or an array and then add it just like that: deciSum =+ hexVal[i]
(say I have a for loop with the array holding the hex values)