StaffList StaffList::searchStaffInRoom(string staff_sep) { StaffList result; for (int i = 0; i<count; i++) { if (staff_list[i].staff_sep == staff_sep) { result.insertStaff(staff_list[i]); } } return result; }
void FileHandler::loadStaffList(string fname, StaffList& s_list) { // open file ifstream fin; fin.open(fname); if (!fin) { cerr << "\n" << "can't open " << fname << "!!"; return; } // read data from file Staff s; while (!fin.eof()) // read data { fin >> s.staff_id >> s.staff_sep >> s.name >> s.birth_date >> s.phone_no >> s.join_date >> s.resign_date; s_list.insertStaff(s); } // close file fin.close(); }