To load the file upfront at the beginning of the program I used the following function with a for loop to initialize the data:
Code:
void initialize (ifstream& inFile, studentType list[], int listSize)
{
int counter;
for (counter = 0; counter < listSize; counter++)
{
inFile >> list[counter].Name >> list[counter].ID >> list[counter].score;
}
}
With this at the top of the file after the struct:
Code:
void initialize (ifstream& inFile, studentType list[], int listSize)
And this within the if where the selection == 'p' or 'P':
Code:
initialize (inFile, studentList, listSize)
Is this correct?