Reading from a file

Assume you want to read from a file and place the data from the file into an array. The array can hold 10 integers. The file may contain any number of integers with 1 integer per line. Fill in the missing loop test condition so that we will read from the file until either end of file occurs or the array is full. Note we are using cin to read from the file since input redirection is being used.
cin >> temp;
arrayIndex = 0;
while ( _____________________________________)
{
array[arrayIndex] = temp;
arrayIndex++;
cin >> temp;
}
1
2
3
4
while(arrayIndex < 10 && !cin.eof() )
{
...
}


That's pretty basic C++...
Why are we still doing OP's homework for him?
Topic archived. No new replies allowed.