// Project 2 for CS 1704 spring 2004 // // Programmer: Foster Lipkey // OS: Windows XP Professional // System: Pentium 4 1800, 256 MB Memory // Compiler: Visual C++ .net // Last modified: Feb 23,2004 // // Purpose // this program keeps track of students and multimedia items // and allows a user to search the list and edit it #include"Organizer.h" #include #include #include ;using namespace std; //prototypes Organizer read(Organizer); bool command(Organizer,ofstream&); int main() { ofstream out("output.data",ios::out); Organizer org; org=read(org); command(org,out); return 0; } ////////////////////////////////////////////////////////////////read // reads int all students and items for intial setup // // Parameters: Organizer list // // Pre: list has been created // // Post: list has been initialized and setup // // Returns: intitialized list // // Called by: main // Calls: addItem,addStudent // Organizer read(Organizer organ) { ifstream students("students.data",ios::in); ifstream items("items.data",ios::in); string temp=""; string hold=""; string name,email,phone,line1,line2,city,state,zip,other; string name1,type,by,owner,price,avail; cout<<"READING STUDENTS)()()()()()()()()()()()()(()()()()()("<>temp) { while(temp!="@@") { if(temp=="@Name:") { getline(students,name);//gets rid of extra return getline(students,name,'\n'); } if(temp=="@E-mail:") { getline(students,email);//gets rid of extra return getline(students,email,'\n'); } if(temp=="@Phone") { students>>temp; if(temp=="Number:") { getline(students,phone);//gets rid of extra return getline(students,phone,'\n'); } } if(temp=="@City:") { getline(students,city);//gets rid of extra return getline(students,city,'\n'); } if(temp=="@State:") { getline(students,state);//gets rid of extra return getline(students,state,'\n'); } if(temp=="@Zipcode:") { getline(students,zip);//gets rid of extra return getline(students,zip,'\n'); } if(temp=="@Address") { students>>temp; if(temp=="Line") { students>>temp; } if(temp=="1:") { getline(students,line1);//gets rid of extra return getline(students,line1,'\n'); } else if(temp=="2:") { getline(students,line2);//gets rid of extra return getline(students,line2,'\n'); } } if(temp=="@Other:") { getline(students,other);//gets rid of extra return getline(students,other,'\n'); } students>>temp; } organ.addStudent(name,phone,email,line1,line2,city,state,zip,other); cout<<"__________________COMPLETED_________________"<>temp) { while(temp!="@@") { if(temp=="@Item:") { getline(items,name1);//gets rid of extra return getline(items,name1,'\n'); cout<<"ITEM : "<>temp; if(temp=="Type:") { getline(items,type);//gets rid of extra return getline(items,type,'\n'); cout<<"type : "<>temp; } organ.addItem(name1,type,by,owner,price,avail); cout<<"__________________COMPLETED_________________"<>com) { if(com=="add") { in>>com; if (com=="student") { //add student cout<<"??ADD STUDENT"<>temp; while(temp!="@@") { if(temp=="@Name:") { getline(in,name);//gets rid of extra return getline(in,name,'\n'); } if(temp=="@E-mail:") { getline(in,email);//gets rid of extra return getline(in,email,'\n'); } if(temp=="@Phone") { in>>temp; if(temp=="Number:") { getline(in,phone);//gets rid of extra return getline(in,phone,'\n'); } } if(temp=="@City:") { getline(in,city);//gets rid of extra return getline(in,city,'\n'); } if(temp=="@State:") { getline(in,state);//gets rid of extra return getline(in,state,'\n'); } if(temp=="@Zipcode:") { getline(in,zip);//gets rid of extra return getline(in,zip,'\n'); } if(temp=="@Address") { in>>temp; if(temp=="Line") { in>>temp; } if(temp=="1:") { getline(in,line1);//gets rid of extra return getline(in,line1,'\n'); } else if(temp=="2:") { getline(in,line2);//gets rid of extra return getline(in,line2,'\n'); } } if(temp=="@Other:") { getline(in,other);//gets rid of extra return getline(in,other,'\n'); } in>>temp; } if(organ.addStudent(name,phone,email,line1,line2,city,state,zip,other)) out<<"Success"<>temp; while(temp!="@@") { if(temp=="@Item:") { getline(in,name1);//gets rid of extra return getline(in,name1,'\n'); cout<<"ITEM : "<>temp; if(temp=="Type:") { getline(in,type);//gets rid of extra return getline(in,type,'\n'); cout<<"type : "<>temp; } if(organ.addItem(name1,type,by,owner,price,avail)) out<<"Success"<>com; cout<<"com : "<>email; out<<"delete "<*/