/* Project 2 for CS 1704, Spring 2004 Programmer: John Christopher Humphreys OS: Windows XP Professional System: Pentium M, 512 MB Compiler: Microsoft Visual Studio.net 2003 Last Modified: February 14, 2004 Purpose- This program will store student data and data of certain items in two arrays. Classes will be created to hold and manage data of each kind, and a class will manage the arrays. Data can be edited, printed, or cleared by the controlling class, and all commands, taken from an input file, will be processed and executed. Format for Comment Block provided by (http://courses.cs.vt.edu/~cs1704/spring2004/Standards/ProgramHeader.txt) */ // This program uses three classes, three input streams, one output stream, and four assert statements #include #include #include #include #include using namespace std; #include "Control.h" // Include Control Class int main() { ifstream commanddata ("commands.data"); // Inputs Commands from Command File ofstream outdata ("output.data"); // Outputs all required data Control Database; // Create object that will control all arrays assert (commanddata); // Make sure "commands.dat" exists and works properly, if not, end program assert (outdata); // Make sure outdata command was created properly string command; // Next command taken from Input File commanddata >> command; // Input next command while(command != "quit") // Loop while quit command is not given { if (command == "print") // If command is 'print', { string printwhat; // Check to see what commanddata >> printwhat; // is to be printed string empty = ""; // Used as substitute for no e-mail address if (printwhat == "students") // If students are to be printed... { Database.PrintStudents(empty, outdata); // Go to function to test and print all students in array } else if (printwhat == "items") // If items are to be printed... { cout << "printitems"; Database.PrintItems(empty, outdata); // Go to function to test and print all items in array } else // If neither students or items are to be printed... { Database.PrintStudents(printwhat, outdata); // Go to function to find e-mail and print student data Database.PrintItems (printwhat, outdata); // Go to function to find e-mail and print all items } } else if (command == "add") // If command is 'print', { string addwhat; // Check to see what commanddata >> addwhat; // is to be added if (addwhat == "item") // If an item is to be added... { Database.AddItem (commanddata, outdata); // Go to function to input data and add to array of items } else if (addwhat == "student") // If a student is to be added... { Database.AddStudent (commanddata, outdata); // Go to function to input data and add to array of students } } else if (command == "delete") // If command is 'delete', { string deletewhat; // Check to see which e-mail commanddata >> deletewhat; // Should be deleted Database.DeleteAllE_Mail (deletewhat, outdata); // Send e-mail to function to search and delete } commanddata >> command; // Input next command } outdata << "quit"; commanddata.close(); // Close input file outdata.close(); // Close output file return 0; } /*On my honor: - I have not discussed the C++ language code in my program with anyone other than my instructor or the teaching assistants assigned to this course. - I have not used C++ language code obtained from another student, or any other unauthorized source, either modified or unmodified. - If any C++ language code or documentation used in my program was obtained from another source, such as a textbook or course notes, that has been clearly noted with a proper citation in the comments of my program. - I have not designed this program in such a way as to defeat or interfere with the normal operation of the Curator System. */