Let's say we have a text file with x amount of strings in it(in seperated lines), we want to load them and treat as hexadecimal numbers.... the question is - how ?
strings are like :
I used to load them into vector of strings, but how to represent them as hexadecimal numbers? What I want to do is to count how many of these numbers are even and how many are odd.
first of all, all characters are actually numbers. The definition of char is actually a 16 bit integer (0 - 255) and it is converted to a character using the ascii table. I am assuming you are trying to put the Hex into a string which means you will need to double the string length to accomplish this since each character including spaces and special characters are represented by 2 Hex digits.
These is a built in feature to convert numbers to hex, I have to remember what it is though because I don't use it, generally i play with bits themselves. I believe it is part of the iostream maybe <hex> or something like that to be used with cout and cin. You might want to take a look at that.