string GPA::queryMap(string fileName) { if(!checkQueryFile(fileName)) { string empty = ""; return empty; } stringstream sout; ifstream queryfile; queryfile.open(fileName.c_str()); string idin; cout << fileName << endl; while(getline(queryfile, idin)) { //cout << "made it here " << idin << endl; stringstream ss; unsigned long long int id; ss << idin; ss >> id; if (mapFindStudent(id) != NULL) { StudentInterface* student = new Student(); delete student; student = mapFindStudent(id); sout << student->getID() << " " << student->getGPA() << " " << student->getName() << "\n"; } } queryfile.close(); return sout.str(); }
StudentInterface* GPA::setFindStudent(unsigned long long int ID) { for(set<StudentInterface*, Comparator>::iterator curr = gpaset.begin(); curr != gpaset.end(); curr++) { StudentInterface* student = *curr; if (student->getID() == ID) { return student; } } return NULL; }