int main(int argc, char* argv[]) { std::cout << "here1"<<std::endl; // process command line arguments if (argc != 3) { std::cerr << "ERROR: incorrect number of command line arguments" << std::endl; std::cerr << "USAGE: " << argv[0] << " <input_file> <output_file>" << std::endl; exit(1); } std::cout << "here2"<<std::endl; // open the input file for parsing std::ifstream istr(argv[1]); if (!istr) { std::cerr << "ERROR: could not open input file " << argv[1] << std::endl; exit(1); } // open the output file std::ofstream ostr(argv[2]); if (!ostr) { std::cerr << "ERROR: could not open output file " << argv[2] << std::endl; exit(1); } // lists to store school and student objects std::list<School> schools; std::list<Student> students; std::cout << "here3"<<std::endl; // parse the file std::string keyword; while(istr >> keyword) { if (keyword == std::string("add_school")) { AddSchool(istr,schools); } else if (keyword == std::string("insert_student_into_school_preference_list")) { InsertStudentIntoSchoolPreferenceList(istr,schools); } else if (keyword == std::string("print_school_preferences")) { PrintSchoolPreferenceList(istr,schools,ostr); } else if (keyword == std::string("add_student")) { AddStudent(istr,students); } else if (keyword == std::string("remove_school_from_student_preference_list")) { RemoveSchoolFromStudentPreferenceList(istr,students); } else if (keyword == std::string("print_student_preferences")) { PrintStudentPreferenceList(istr,students,ostr); } else if (keyword == std::string("perform_matching")) { std::cout << "here3"<<std::endl; PerformMatching(schools,students,ostr); } else if (keyword == std::string("print_school_enrollments")) { PrintSchoolEnrollments(schools,ostr); } else if (keyword == std::string("print_student_decisions")) { PrintStudentDecisions(students,ostr); } else { std::cerr << "unknown keyword in input file: " << keyword << std::endl; exit(1); } } }
/* Creates 'count' random students. */ void __fastcall TfrmObjAllocMain::CreateStudents(int count) { for (int i = 0; i < count; i++) if (!AddStudent(false)) break; DumpStudents(); DumpFreeList(); DumpMemory(); }
void __fastcall TfrmObjAllocMain::btnCreateOneStudentClick(TObject *Sender) { AddStudent(); }