Put the code you need help with here.
//A function that will convert a hexadecimal into decimal and returns the integer back to main.
//The Parameters is the array of chars.
int hexToDecimal(constchar* hex);
constint MAX_SIZE = 15;
char* hexarray = newchar[MAX_SIZE];
for (int i = 0; i <= MAX_SIZE; i++)
hexa >> hexarray[i];
cout << hexarray[i];
I am trying to read this text file: aef301
in to the char array. But it comes out as one line and not separated by enters. How would I implement each element of the array to each row in the text file. Please help. THank you.
Wow! It worked. Can u explain to me why? what does this function do? THank you! Also, with this, will I be able to convert each line or row in to decimal properly? Cause get() seems to just copy the txt file and not organize each row in to an element in to the array. I am not too sure. Thank you.
Oh wow. getline is really useful. Hmm. I can explore more with this. Thank you. Sorry, but I have one more question. If I want to convert each of these hexidecimals into intergers recursively, what kind of a strategy should I think about? I am currently learning recursive functions and its not really making sense. Thanks again.