Have you learned while loops? Then you could use while(inFile >> student[count]) and increment count in the body of the loop. That way you'll be able to use that count in a subsequent for loop to display your array rather than displaying empty portions at the end. If you haven't learned while loops you can use a for loop but keep track of count separately from the loop counter.
There are a few inconsistencies with your for loops. In the first one, you're incrementing count in the body of the loop as well as in the loop conditions. Your count will reach the amount "questions" twice as fast.
In the last loop, your condition is i<count-1 but this way you will miss the last element of your array as indexing starts at 0 and count-1 will be the last index but as you have it it will stop at count - 2.
A compiling program is not necessarily doing what you want at runtime.
I still think the while loop is your best bet as long as that's been covered in the class. Read about all the behind the scenes work that ifstream is doing for you. Then you won't have to worry about the loops since you'll have your count.
int count = 0;
while(inFile >> student[i])
because each time that loop condition is tested to see whether or not to proceed with the loop, you get a character. When characters are no longer able to be read, the loop halts. Now you have your characters and you have your count!
(Ignore the thing about layout I should have checked it _before_ I posted it, it turns out not to matter)
Need some help with this Array. I am trying to get the sum of the even numbers and the sum of the odd numbers using a for each loop. I know the answers to what I am trying to achive are sum of even = 84 and the sum of ...
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...