I've been struggling with this for a few days now. I've finally got it working in pieces, but when my sorting array runs, all I get is empty space. My brain is fried at this point, I can't figure out if it's a simple fix, or a major flaw. This is my first time asking for help online, thank you in advance for any assistance.
You already go through the file once before the for-loop. Thus, when you enter the for-loop, the file pointer is already at the end of the file and there is nothing to read. This is why the array remains empty. You need to move back to the beginning of the file so you can fill up the array. You can do that using the following two lines of code:
1 2
inputFile.clear(); // resets from EOF state to good state
inputFile.seekg(0, ios::beg); // moves file pointer back to the beginning