I didn't notice this until I recently tested it, but the function I did in a program is supposed to read a list of students that another function output, and then it is to output it in order by reference number. The output is in the form of

"IDNumber LastName Firstname Email@mdcc.edu 6digrefNum"

the first being the id number, second being last name, then first, then the e-mail, then the reference number. When I ouput it, it only captures the first id number and utputs that seperated. I want it so that it will caputre the first, output that and ignore all other numbers, then do similar with the other reference numbers.

is there a problem with my codeCode:void ReportOutput(ifstream & inFile, ofstream & outFile2, string SSN, string LastName, string FirstName, string & semester, string & Email, int choice, int students, int ReferenceNum, int RefNum[]) { if (!inFile) { cerr << "File could not be opened" << endl; exit(1); } if (inFile==NULL) { cout<<"The file does not exist"; exit(0); } outFile2 << "\n\n\nReference Number " << RefNum[0] << endl; outFile2 << "\n\n\nSSN" << right << setw(20) << right << setw(20) << "Last" << right << setw(20) << "First " << right << setw(20) << "E-mail@mdcc.edu\n"; while (!inFile.eof()) { inFile >> SSN >> LastName >> FirstName >> Email >> ReferenceNum; if(ReferenceNum==RefNum[0]) { outFile2 << right << SSN << right << setw(17) << LastName << right << setw(16) << FirstName << right << setw(20) << Email; break; } } inFile.seekg(0, ios::beg); int n; for(n = 0; n!=40; n++) {outFile2 << "\n";} outFile2 << "Reference Number" << RefNum[1] << endl; outFile2 << "\n\n\nSSN" << right << setw(20) << right << setw(20) << "Last" << right << setw(20) << "First " << right << setw(20) << "E-mail@mdcc.edu\n"; while (!inFile.eof()) { inFile >> SSN >> LastName >> FirstName >> Email >> ReferenceNum; if(ReferenceNum==RefNum[0]) { outFile2 << right << SSN << right << setw(17) << LastName << right << setw(16) << FirstName << right << setw(20) << Email; break; } } inFile.seekg(0, ios::beg); for(n = 0; n!=40; n++) {outFile2 << "\n";} outFile2 << "Reference Number" << RefNum[2] << endl; outFile2 << "\n\n\nSSN" << right << setw(20) << right << setw(20) << "Last" << right << setw(20) << "First " << right << setw(20) << "E-mail@mdcc.edu\n"; while (!inFile.eof()) { inFile >> SSN >> LastName >> FirstName >> Email >> ReferenceNum; if(ReferenceNum==RefNum[0]) { outFile2 << right << SSN << right << setw(17) << LastName << right << setw(16) << FirstName << right << setw(20) << Email; break; } } }

btwCode:int RefNum[3]{111111, 222222, 333333};