#include #include #include #include "StudentData.h" #include "MultimediaData.h" #include "Organizer.h" using namespace std; int main() { ofstream outFile("output.data"); ifstream commandFile("commands.data"); organizer organizerData; organizerData.fillStudents(); organizerData.fillItems(); string command; string email; commandFile >> command; while(commandFile) { if(command == "delete") { commandFile >> email; outFile << "delete " << email << endl; if(organizerData.removeStudent(email) == 1) { outFile << "Success" << endl; } else { outFile << "Failure" << endl; } } else if(command == "print") { string printWhat; commandFile >> printWhat; if(printWhat == "students") { outFile << "print students" << endl; for(int i = 0; i < 100; i++) { organizerData.printStudents(i, outFile); } } else if(printWhat == "items") { outFile << "print items" << endl; int printEmails = 1; for(int i = 0; i < 100; i++) { organizerData.printItems(i, outFile, printEmails); } } else { outFile << "print " << printWhat << endl; organizerData.printEmail(printWhat, outFile); } } else if(command == "add") { string addWhat; string firstHeader; commandFile >> addWhat; if(addWhat == "item") { outFile << "add item" << endl; getline(commandFile, firstHeader, '\n'); if(organizerData.addItem(commandFile, firstHeader) == 1) { outFile << "Success" << endl; } else { outFile << "Failure" << endl; } firstHeader == ""; } else if(addWhat == "student") { outFile << "add student" << endl; commandFile >> firstHeader; if(organizerData.addStudent(commandFile, firstHeader) == 1) { outFile << "Success" << endl; } else { outFile << "Failure" << endl; } firstHeader == ""; } } else if(command == "quit") { outFile << "quit"; outFile.close(); exit; } else { commandFile.ignore(1000, '\n'); } commandFile.ignore(1000, '\n'); commandFile >> command; } return 0; }