cout << "Enter Student ID (999 to end): "; cin >> searchId;
inFile.open(file + ".txt");
inFile.ignore(80, '\n');
while (searchId != 999)
{
for (int i = 0; i <= count; i++)
{
inFile >> ID >> lastName >> firstName >> q1 >> q2 >> q3 >> q4 >> final;
if (searchId == ID)
{
avgGrd(q1, q2, q3, q4, final, average, grade);
cout << " " << left << setw(12) << lastName << " " << setw(12) << firstName << ' '
<< setw(3) << average << ' ' << setw(2) << grade << endl;
cout << "Enter Student ID (999 to end): "; cin >> searchId;
}
}
}cout << "Enter any character: "; cin >> end;
This is what I have so far. And this works up to about 3 iterations and then stops. I'm not sure why. Also, everytime I try to make it so it will output "Record not found!" for an invalid input it does that for every input thereafter. Please Help!