here is the given code.
basically the program is supposed to open up the .txt file and save the data from the .txt to an apvector.
apstring bd; // birthdate
apvector <student> getStudents( ifstream list );
student getData( apvector <student>, int );
idFile.open("idp4.txt");// means ID number period 4,
// if that clarifies anything
apvector <student> p4 ( getStudents ( idFile ) );
cout << "Enter an id number: ";
cin >> id1;
student current = getData ( p4, id1 );
if( current.last != "Not Found" )
cout << current.id << '\t'
<< current.first << '\t'
<< current.last << '\t'
<< current.grade <<'\t'
<< current.gender<< '\t'
<< current.bd<< endl;
cout << "ID number "<< id1 << " not found.\n";
apvector <student> getStudents( ifstream list )
/* pre: list is open and contains student data as follows
grade level ( 9 10 11 12 )
gender ( m f )
birthday ( day/month )
post: data in file is stored in an apvector of type student
student getData( apvector <student> thisClass, int thisID )
/* pre: thisClass is initialized as is thisID
post: returns student data for matching id if found
if id is not found, returns a student with "Not Found"
in the last name field
ok that's it... I have a few questions
for... apvector<students>getStudents (ifstream list) ... I know I'm supposed to make something like:
with a loop or something.. but what I don't get is how the program giong to know where the first person's info starts/ends and second person's begins...
How do you store a person's info in an apvector if the .txt is one big file with everyone's name/ID/birthdate/grade lvl... etc.? It doesn't know when the second person's info begins, so then I don't know when to save person[i].id... beacuse I think I'm gonna save the entire .txt file to "person[i].id" or something..
kinda confusing here but help plz