Use ifstream to open and read the integers from a text file into an array. Your program should have a loop that will read a single integer and insert it into the next available index of the array. I'm sure your text book has examples of how to do something like that.
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
close. After this loop finished, counter will contain the number of elements read, so you should use that variable instead of SIZE when searching the array.
add #include <fstream>
ifstream in("C:/path/to/text/file.txt");
int counter = 0;
while (counter < SIZE && in >> bench[counter] )
{
counter++;
}
in.close()
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343