// Project 2 for CS 1074 Spring 2004 // // Programmer: Te-Hsu Lien // OS: Windows XP Professional // Last modified: Feb 22, 2004 // // Purpose // This program reads three files that contains students info, item // info, and command info. Then it will organize these three files. // // The program then writes a summary of its findings to an output // file. // #include #include #include #include #include #include #include #include "student.h" #include "item.h" #include "organizer.h" using namespace std; int main() { string com = ""; string temp = ""; string header = ""; string data = ""; //student data: string studentName; string phoneNumber; string email; string addOne; string addTwo; string city; string state; string zip; string otherInfo; //item data: string itemName; string type; string author; string owner; string price; string availability; const string input1 = "commands.data"; //Command File const string output1 = "output.data"; //Output File organizer o; ifstream command; ofstream out; command.open(input1.c_str()); out.open(output1.c_str()); assert(!command.fail()); assert(!out.fail()); while (!command.fail()) { //initialize all datas header = ""; //student data studentName = ""; phoneNumber = ""; email = ""; addOne = ""; addTwo = ""; city = ""; state = ""; zip = ""; otherInfo = ""; //item data itemName = ""; type = ""; author = ""; owner = ""; price = ""; availability = ""; getline (command, com, ' '); if (com == "print") { getline(command, temp, '\n'); //print students if (temp == "students") { out<