Okay, I have the basis for the rpogram I am doing, it basically is supposed to read a students info, then output it on the screen, I do not have to organize the output by the student's reference number now, but I wanted to know how I am supposed to do it. I was thinking that i could re-read the input file to recognize each reference number and skip pages in between the two. here is my code, that does the output, but I am not sure what I should do to organize the output by reference number
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
string SSN, LastName, FirstName, ReferenceNum;
ofstream outFile;
ifstream inFile;
outFile.open("a:report.txt", ios::out);
inFile.open("a:StudentData.txt", ios::in);
outFile << setw(6) << "Introduction to C"
<< setw(5) <<"\nTerm: Fall 2002"
<< setw(5) << "\nRef#"
<< "\n\n\nSSN" << right << setw(20) << right << setw(20) << "Last"
<< right << setw(20) << "First" << right << setw(20) << "Reference#\n";
while (inFile)
{
inFile >> SSN >> LastName >> FirstName >> ReferenceNum;
outFile << right << SSN << right << setw(17) << LastName << right
<< setw(16) << FirstName << right << setw(17)<< ReferenceNum << "\n";
}
return 0;
}
posted the wrong code before, it's changed now