I copied some code straight out of the book and cannot read from a file.
gradfile.txt is made, placed in the project directory, and has:
100
200
300
any ideas?
Stupid me. I had "gradfile.txt.txt"...
I am doing the find the average, lowest, highest, from a file with functions and had to take it a few steps back to figure out this issue.
Thanks!
This question is still about input from a file so i'll post here.
1 2 3 4 5 6 7 8
while (inputFile >> grades[pos])
{
pos++;
inputFile >> grades[pos];
}
only the high is correct.
so while the first grade is being loaded in the array
increment the counter, which is set to 0
and input the next until no more input, correct?
I used a for loop since I knew how many inputs there would be, which worked, but still don't get how the while didn't work