/////////////////////////////////////////////////////////////////////////// // Comments: // // 1) Not finished due to the following bugs. // // A) Can't figure out how to pass my streams to the classes so that // the information stays in the program instead of defaulting to // junk information. I input the information correctly but just // can't figure out how to store it. // // B) The data is not formatted because I could not get A to work right. // // C) Asserts are not included in the program because of A. // ////////////////////////////////////////////////////////////////////////////// // // .^. // / | \ // | // | // | // | // //////////////////////////////////////////////////////////////////////////// // 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 text book 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. // // Matthew J. Travis // // // CS 1704 Project Two - Spring 2004 // // Student: Matthew J. Travis // // Programmer: Matthew J. Travis // OS: Windows XP Pro // System: Pentium 4 2.53 ghz, 1024 MB Memory // Compiler: Visual C++ .Net // Last modified: February 26, 2004 // // Purpose // // To simulate a database of loan information using multiple classes. // // Include Statements #include #include #include #include #include #include using namespace std; //////////////////////////////////////////////////////////////// // Students Class // // Holds all the student information in the "database" // class Students{ private: string Student; // Student int AreaCode; // Area Code int FirstThree; // First 3 digits of the phone number int LastFour; // Last 4 digits of the phone number string Email; // Email address string Line1; // Line one of the address string Line2; // Line two of the address string City; // City string State; // State int Zip; // Zip code string Other; // Other field public: StudentRecord(); // Default Constructor StudentRecord(const string iStudent, // Parameter Constructor const int iAreaCode, const int iFirstThree, const int iLastFour, const string iEmail, const string iLine1, const string iLine2, const string iCity, const string iState, const int iZip, const string iOther); // Reporter Member Functions string getStudent() const; int getAreaCode() const; int getFirstThree() const; int getLastFour() const; string getEmail() const; string getLine1() const; string getLine2() const; string getCity() const; string getState() const; int getZip() const; string getOther() const; // Mutator Member Functions void setStudent(const string StudentName); void setAreaCode(const int Area); void setFirstThree(const int First); void setLastFour(const int Last); void setEmail(const string Mail); void setLine1(const string LineOne); void setLine2(const string LineTwo); void setCity(const string CityName); void setState(const string StateName); void setZip(const int Zipcode); void setOther(const string Info); }; // Class Functions //------------------ Constructor Functions --------------------- //////////////////////////////////////////////////////////////// // Default Constructor for Students Class // // Parameters: none // Pre: none // Post: StudentsRecord object has been initialized // Students::StudentRecord(){ Student = "Empty"; AreaCode = -1; FirstThree = -1; LastFour = -1; Email = "Empty"; Line1 = "Empty"; Line2 = "Empty"; City = "Empty"; State = "Empty"; Zip = -1; Other = "Empty"; } //////////////////////////////////////////////////////////////// // Parameter Constructor for Students Class // // Parameters: Students // Pre: none // Post: StudentsRecord object has been set // Students::StudentRecord(const string iStudent, // Parameter Constructor const int iAreaCode, const int iFirstThree, const int iLastFour, const string iEmail, const string iLine1, const string iLine2, const string iCity, const string iState, const int iZip, const string iOther){ Student = iStudent; AreaCode = iAreaCode; FirstThree = iFirstThree; LastFour = iLastFour; Email = iEmail; Line1 = iLine1; Line2 = iLine2; City = iCity; State = iState; Zip = iZip; Other = iOther; } //----------------- Reporter Functions -------------------------- ///////////////////////////////////////////////////////////////// // Used to pull or report information stored in the class object // // Parameters: Students // Pre: Students object has been set // Post: Information has been returned // string Students::getStudent() const{ return(Student); } int Students::getAreaCode() const{ return(AreaCode); } int Students::getFirstThree() const{ return(FirstThree); } int Students::getLastFour() const{ return(LastFour); } string Students::getEmail() const{ return(Email); } string Students::getLine1() const{ return(Line1); } string Students::getLine2() const{ return(Line2); } string Students::getCity() const{ return(City); } string Students::getState() const{ return(State); } int Students::getZip() const{ return(Zip); } string Students::getOther() const{ return(Other); } //-------------------------Mutator Functions------------------------- ///////////////////////////////////////////////////////////////////// // Used to change information stored in the class object // // Parameters: Students // Pre: Students object has been set // Post: Information has been changed // void Students::setStudent(const string StudentName){ Student = StudentName; } void Students::setAreaCode(const int Area){ AreaCode = Area; } void Students::setFirstThree(const int First){ FirstThree = First; } void Students::setLastFour(const int Last){ LastFour = Last; } void Students::setEmail(const string Mail){ Email = Mail; } void Students::setLine1(const string LineOne){ Line1 = LineOne; } void Students::setLine2(const string LineTwo){ Line2 = LineTwo; } void Students::setCity(const string CityName){ City = CityName; } void Students::setState(const string StateName){ State = StateName; } void Students::setZip(const int Zipcode){ Zip = Zipcode; } void Students::setOther(const string Info){ Other = Info; } //------------------------------------------------------------------------ ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////// // Items Class // // Holds all the item information in the "database" // class Items{ private: string Item; // Item string Type; // Type of media string By; // Creator of said item string Owner; // Owner of said item double Price; // Cost of the item string Availability; // Availability of the item public: ItemRecord(); // Default Constructor ItemRecord(const string iItem, // Parameter Constructor const string iType, const string iBy, const string iOwner, const double iPrice, const string iAvailability); // Reporter Member Functions string getItem() const; string getType() const; string getBy() const; string getOwner() const; double getPrice() const; string getAvailability() const; // Mutator Member Functions void setItem(const string ItemName); void setType(const string TypeName); void setBy(const string Who); void setOwner(const string Person); void setPrice(const double Cost); void setAvailability(const string Available); }; // Class Functions //------------------ Constructor Functions --------------------- //////////////////////////////////////////////////////////////// // Default Constructor for Items Class // // Parameters: none // Pre: none // Post: ItemsRecord object has been initialized // Items::ItemRecord(){ Item = "Empty"; Type = "Empty"; By = "Empty"; Owner = "Empty"; Price = -9.99; Availability = "Empty"; } //////////////////////////////////////////////////////////////// // Parameter Constructor for Items Class // // Parameters: Items // Pre: none // Post: ItemsRecord object has been set // Items::ItemRecord(const string iItem, // Parameter Constructor const string iType, const string iBy, const string iOwner, const double iPrice, const string iAvailability){ Item = iItem; Type = iType; By = iBy; Owner = iOwner; Price = iPrice; Availability = iAvailability; } //----------------- Reporter Functions -------------------------- ///////////////////////////////////////////////////////////////// // Used to pull or report information stored in the class object // // Parameters: Items // Pre: Items object has been set // Post: Information has been returned // string Items::getItem() const{ return(Item); } string Items::getType() const{ return(Type); } string Items::getBy() const{ return(By); } string Items::getOwner() const{ return(Owner); } double Items::getPrice() const{ return(Price); } string Items::getAvailability() const{ return(Availability); } //-------------------------Mutator Functions------------------------- ///////////////////////////////////////////////////////////////////// // Used to change information stored in the class object // // Parameters: Items // Pre: Items object has been set // Post: Information has been changed // void Items::setItem(const string ItemName){ Item = ItemName; } void Items::setType(const string TypeName){ Type = TypeName; } void Items::setBy(const string Who){ By = Who; } void Items::setOwner(const string Person){ Owner = Person; } void Items::setPrice(const double Cost){ Price = Cost; } void Items::setAvailability(const string Available){ Availability = Available; } //------------------------------------------------------------------------ ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////// // Arrays Class // // Holds all the array information in the "database" // class Arrays{ private: Students StudentArray[100]; // Student Array Items ItemArray[100]; // Items Array public: ArraysList(); // Default Constructor ArraysList(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out); // Parameter Constructor // Reporter Member Functions void CheckStudent(ofstream& Out, ifstream& Cstream, ifstream& Istream, ifstream& Sstream, int& StudentNumber, const string EmailAddress); void PrintStudents(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out); void PrintItems(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out); void PrintEmail(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const int StudentNumber); // Mutator Member Functions void AddStudent(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const string Name, const int Code, const int First, const int Last, const string EmailAccount, const string One, const string Two, const string CityName, const string StateName, const int ZipCode, const string OtherThing); void AddItem(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const string ItemName, const string Media, const string ByWhom, const string Person, const double Money, const string There); void RemoveEmail(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const string EmailAddress); }; // Class Functions //------------------ Constructor Functions --------------------- //////////////////////////////////////////////////////////////// // Default Constructor for Arrays Class // // Parameters: none // Pre: none // Post: ArraysRecord object has been initialized // Arrays::ArraysList(){ // Declare function variables string empty = "Empty"; int number = -1; double price = -9.99; // Clear all values for (int a = 0; a < 100; a++){ StudentArray[a].setStudent(empty); StudentArray[a].setAreaCode(number); StudentArray[a].setFirstThree(number); StudentArray[a].setLastFour(number); StudentArray[a].setEmail(empty); StudentArray[a].setLine1(empty); StudentArray[a].setLine2(empty); StudentArray[a].setCity(empty); StudentArray[a].setState(empty); StudentArray[a].setZip(number); StudentArray[a].setOther(empty); ItemArray[a].setItem(empty); ItemArray[a].setType(empty); ItemArray[a].setBy(empty); ItemArray[a].setOwner(empty); ItemArray[a].setPrice(price); ItemArray[a].setAvailability(empty); } } //////////////////////////////////////////////////////////////// // Parameter Constructor for Arrays Class // // Parameters: none // Pre: none // Post: ArraysRecord object has been initialized // Arrays::ArraysList(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out){ // Declare function variables string empty = "Empty"; int number = -1; double price = -9.99; // Clear all values for (int a = 0; a < 100; a++){ StudentArray[a].setStudent(empty); StudentArray[a].setAreaCode(number); StudentArray[a].setFirstThree(number); StudentArray[a].setLastFour(number); StudentArray[a].setEmail(empty); StudentArray[a].setLine1(empty); StudentArray[a].setLine2(empty); StudentArray[a].setCity(empty); StudentArray[a].setState(empty); StudentArray[a].setZip(number); StudentArray[a].setOther(empty); ItemArray[a].setItem(empty); ItemArray[a].setType(empty); ItemArray[a].setBy(empty); ItemArray[a].setOwner(empty); ItemArray[a].setPrice(price); ItemArray[a].setAvailability(empty); } } //----------------- Reporter Functions -------------------------- ///////////////////////////////////////////////////////////////// // Used to pull or report information stored in the class object // // Parameters: Items // Pre: Items object has been set // Post: Information has been returned // //////////////////////////////////////// // Check to see if the Student exists // //////////////////////////////////////// void Arrays::CheckStudent(ofstream& Out, ifstream& Cstream, ifstream& Istream, ifstream& Sstream, int& StudentNumber, const string EmailAddress){ for (int a = 0; a < 100; a++){ if (StudentArray[a].getEmail() == EmailAddress){ Out << StudentArray[a].getEmail() << endl; StudentNumber = a; } } } ////////////////////////////////////////////////////// // Print out all the students and their information // ////////////////////////////////////////////////////// void Arrays::PrintStudents(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out){ // Do a loop that prints out all the students and their information Out << "print students" << endl; for (int a = 0; a < 100; a++){ if (StudentArray[a].getStudent() != "Empty"){ Out << "Name:" << endl << " " << StudentArray[a].getStudent() << endl; } if (StudentArray[a].getAreaCode() != -1){ Out << "Phone Number:" << endl << " (" << StudentArray[a].getAreaCode() << ") " << StudentArray[a].getFirstThree() << "-" << StudentArray[a].getLastFour() << endl; } Out << "Email:" << endl << " " << StudentArray[a].getEmail() << endl; if (StudentArray[a].getLine1() != "Empty"){ Out << "Address:" << endl << " " << StudentArray[a].getLine1() << endl; } if (StudentArray[a].getLine2() != "Empty"){ Out << " " << StudentArray[a].getLine2() << endl; } if (StudentArray[a].getCity() != "Empty" || StudentArray[a].getState() != "Empty" || StudentArray[a].getZip() != -1){ Out << "Address:" << endl << " "; if (StudentArray[a].getCity() != "Empty"){ Out << StudentArray[a].getCity(); if (StudentArray[a].getState() != "Empty" || StudentArray[a].getZip() != -1){ Out << ","; } if (StudentArray[a].getState() != "Empty"){ Out << " " << StudentArray[a].getState(); } if (StudentArray[a].getZip() != -1){ Out << " " << StudentArray[a].getZip(); } Out << endl; } } if (StudentArray[a].getOther() != "Empty"){ Out << "Other:" << endl << " " << StudentArray[a].getOther() << endl; } Out << endl; } } /////////////////////////////////////////////////// // Print out all the items and their information // /////////////////////////////////////////////////// void Arrays::PrintItems(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out){ // Do a loop that prints out all the items and their information Out << "print items" << endl; for (int a = 0; a < 100; a++){ if (ItemArray[a].getItem() != "Empty"){ Out << "Item:" << endl << " " << ItemArray[a].getItem() << endl; } if (ItemArray[a].getType() != "Empty"){ Out << "Media Type:" << endl << " " << ItemArray[a].getType() << endl; } if (ItemArray[a].getBy() != "Empty"){ Out << "By:" << endl << " " << ItemArray[a].getBy() << endl; } Out << "Owner:" << endl << " " << ItemArray[a].getOwner() << endl; if (ItemArray[a].getPrice() != -9.99){ Out << "Price:" << endl << " " << ItemArray[a].getPrice() << endl; } if (ItemArray[a].getAvailability() != "Empty"){ Out << "Availability:" << endl << " " << ItemArray[a].getAvailability() << endl; } Out << endl; } } //////////////////////////////////////////////////////////////////// // Print all items owned by a student of a specific Email address // //////////////////////////////////////////////////////////////////// void Arrays::PrintEmail(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const int StudentNumber){ // First output all student information if (StudentArray[StudentNumber].getStudent() != "Empty"){ Out << "Name:" << endl << " " << StudentArray[StudentNumber].getStudent() << endl; } if (StudentArray[StudentNumber].getAreaCode() != -1){ Out << "Phone Number:" << endl << " (" << StudentArray[StudentNumber].getAreaCode() << ") " << StudentArray[StudentNumber].getFirstThree() << "-" << StudentArray[StudentNumber].getLastFour() << endl; } Out << "Email:" << endl << " " << StudentArray[StudentNumber].getEmail() << endl; if (StudentArray[StudentNumber].getLine1() != "Empty"){ Out << "Address:" << endl << " " << StudentArray[StudentNumber].getLine1() << endl; } if (StudentArray[StudentNumber].getLine2() != "Empty"){ Out << " " << StudentArray[StudentNumber].getLine2() << endl; } if (StudentArray[StudentNumber].getCity() != "Empty" || StudentArray[StudentNumber].getState() != "Empty" || StudentArray[StudentNumber].getZip() != -1){ Out << "Address:" << endl << " "; if (StudentArray[StudentNumber].getCity() != "Empty"){ Out << StudentArray[StudentNumber].getCity(); if (StudentArray[StudentNumber].getState() != "Empty" || StudentArray[StudentNumber].getZip() != -1){ Out << ","; } if (StudentArray[StudentNumber].getState() != "Empty"){ Out << " " << StudentArray[StudentNumber].getState(); } if (StudentArray[StudentNumber].getZip() != -1){ Out << " " << StudentArray[StudentNumber].getZip(); } Out << endl; } } if (StudentArray[StudentNumber].getOther() != "Empty"){ Out << "Other:" << endl << " " << StudentArray[StudentNumber].getOther() << endl; } Out << endl; // Now output all the items for (int a = 0; a < 100; a++){ if (ItemArray[a].getItem() != "Empty"){ Out << "Item:" << endl << " " << ItemArray[a].getItem() << endl; } if (ItemArray[a].getType() != "Empty"){ Out << "Media Type:" << endl << " " << ItemArray[a].getType() << endl; } if (ItemArray[a].getBy() != "Empty"){ Out << "By:" << endl << " " << ItemArray[a].getBy() << endl; } if (ItemArray[a].getPrice() != -9.99){ Out << "Price:" << endl << " " << ItemArray[a].getPrice() << endl; } if (ItemArray[a].getAvailability() != "Empty"){ Out << "Availability:" << endl << " " << ItemArray[a].getAvailability() << endl; } Out << endl; } } //-------------------------Mutator Functions------------------------- ///////////////////////////////////////////////////////////////////// // Used to change information stored in the class object // // Parameters: Items // Pre: Items object has been set // Post: Information has been changed // ////////////////////////////////////////////////// // Add a student to the database of information // ////////////////////////////////////////////////// void Arrays::AddStudent(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const string Name, const int Code, const int First, const int Last, const string EmailAccount, const string One, const string Two, const string CityName, const string StateName, const int ZipCode, const string OtherThing){ for (int a = 0; a < 100; a++){ if (StudentArray[a].getEmail() == "Empty"){ StudentArray[a].setStudent(Name); StudentArray[a].setAreaCode(Code); StudentArray[a].setFirstThree(First); StudentArray[a].setLastFour(Last); StudentArray[a].setEmail(EmailAccount); StudentArray[a].setLine1(One); StudentArray[a].setLine2(Two); StudentArray[a].setCity(CityName); StudentArray[a].setState(StateName); StudentArray[a].setZip(ZipCode); StudentArray[a].setOther(OtherThing); a = 200; Out << "Success" << endl; } if (a > 99 && a < 150){ Out << "Failure" << endl; } } } //////////////////////////////////////////////// // Add an item to the database of information // //////////////////////////////////////////////// void Arrays::AddItem(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const string ItemName, const string Media, const string ByWhom, const string Person, const double Money, const string There){ for (int a = 0; a < 100; a++){ if (ItemArray[a].getOwner() == "Empty"){ ItemArray[a].setItem(ItemName); ItemArray[a].setType(Media); ItemArray[a].setBy(ByWhom); ItemArray[a].setOwner(Person); ItemArray[a].setPrice(Money); ItemArray[a].setAvailability(There); a = 200; Out << "Success" << endl; } if (a > 99 && a < 150){ Out << "Failure" << endl; } } } ////////////////////////////////////////////////////////////////////////////// // Remove all instances of the student from the items list and student list // ////////////////////////////////////////////////////////////////////////////// void Arrays::RemoveEmail(ifstream& Cstream, ifstream& Istream, ifstream& Sstream, ofstream& Out, const string EmailAddress){ int Checker = 0; // Checks for validity string empty = "Empty"; int number1 = -1; double number2 = -9.99; for (int a = 0; a < 100; a++){ if (StudentArray[a].getEmail() == EmailAddress){ StudentArray[a].setStudent(empty); StudentArray[a].setAreaCode(number1); StudentArray[a].setFirstThree(number1); StudentArray[a].setLastFour(number1); StudentArray[a].setEmail(empty); StudentArray[a].setLine1(empty); StudentArray[a].setLine2(empty); StudentArray[a].setCity(empty); StudentArray[a].setState(empty); StudentArray[a].setZip(number1); StudentArray[a].setOther(empty); Checker = 1; } if (ItemArray[a].getOwner() == EmailAddress){ ItemArray[a].setItem(empty); ItemArray[a].setType(empty); ItemArray[a].setBy(empty); ItemArray[a].setOwner(empty); ItemArray[a].setPrice(number2); ItemArray[a].setAvailability(empty); } } if (Checker == 0){ Out << "Failure" << endl; } if (Checker == 1){ Out << "Success" << endl; } } //------------------------------------------------------------------------ ----------------------------------------------------------------------------- //////////////////// // Begin Main() // //////////////////// int main(){ ifstream Sstream("students.data"); ifstream Istream("items.data"); ifstream Cstream("commands.data"); ofstream Out("output.data"); Out << fixed << showpoint; // Declare variables Arrays List; int Area = -1, First = -1, Last = -1, Zip = -1, StudentNumber = 0; double Price = -9.99; string Command, Temp, WhiteSpace = " ", Name = "Empty", Email = "Empty", AddLine1 = "Empty", AddLine2 = "Empty", City = "Empty", State = "Empty", Other = "Empty", Item = "Empty", Type = "Empty", By = "Empty", Owner = "Empty", Availability= "Empty", At3 = "@"; char At = '@', At2, Left = '(', Right = ')', Dash = '-'; /* getline(Cstream, Command, '\n'); // doing comparison of append and getline (ignore this) Out << Command; Cstream >> Command >> Temp; // fooling around with appending strings (ignore this) Command.append(WhiteSpace); Command.append(Temp); Out << Command; */ // Do a loop inputting the student information into the student array. while (Sstream){ // Out << Command << endl; while (Command != At3 && Sstream){ Sstream >> At2; getline(Sstream, Command, '\n'); while (Sstream.peek() != At && Command != At3 && Sstream){ if (Command == "Name:"){ getline(Sstream, Name, '\n'); } if (Command == "Phone Number:"){ Sstream >> Left >> Area >> Right >> First >> Dash >> Last; } if (Command == "E-mail:"){ Sstream >> Email; } if (Command == "Address Line 1:"){ getline(Sstream, AddLine1, '\n'); } if (Command == "Address Line 2:"){ getline(Sstream, AddLine2, '\n'); } if (Command == "City:"){ getline(Sstream, City, '\n'); } if (Command == "State:"){ Sstream >> State; } if (Command == "Zipcode:"){ Sstream >> Zip; } if (Command == "Other:"){ getline(Sstream, Other, '\n'); } Sstream >> At2; getline(Sstream, Command, '\n'); } if (Command == At3){ List.AddStudent(Cstream, Istream, Sstream, Out, Name, Area, First, Last, Email, AddLine1, AddLine2, City, State, Zip, Other); Sstream.ignore(INT_MAX, '\n'); } } Command = "Empty"; } // Inputs the Items while (Istream){ while (Command != At3 && Istream){ Istream >> At2; getline(Istream, Command, '\n'); while (Istream.peek() != At && Command != At3 && Istream){ if (Command == "Item:"){ getline(Istream, Item, '\n'); } if (Command == "Media Type:"){ getline(Istream, Type, '\n'); } if (Command == "by:"){ getline(Istream, By, '\n'); } if (Command == "Owner:"){ getline(Istream, Owner, '\n'); } if (Command == "Price:"){ Istream >> At2 >> Price; } if (Command == "Availability:"){ getline(Istream, Availability, '\n'); } Istream >> At2; getline(Istream, Command, '\n'); } if (Command == At3){ List.AddItem(Cstream, Istream, Sstream, Out, Item, Type, By, Owner, Price, Availability); Istream.ignore(INT_MAX, '\n'); } } Command = "Empty"; } // Do a loop that inputs the commands, inputs the correct information into variables // based on the inputted command, and then passes that information to the appropriate // functions in the array class. while (Cstream){ // Wipe all variables Area = -1; First = -1; Last = -1; Zip = -1; Price = -9.99; Name = "Empty"; Email = "Empty"; AddLine1 = "Empty"; AddLine2 = "Empty"; City = "Empty"; State = "Empty"; Other = "Empty"; Item = "Empty"; Type = "Empty"; By = "Empty"; Owner = "Empty"; Availability= "Empty"; // Input the Command Cstream >> Command; if (Command == "delete"){ Cstream >> Command; // Out << "remove " << Command << endl; // List.RemoveEmail(Cstream, Istream, Sstream, Out, Command); } if (Command == "print"){ Cstream >> Command; if (Command == "students"){ // List.PrintStudents(Cstream, Istream, Sstream, Out); } if (Command == "items"){ // List.PrintItems(Cstream, Istream, Sstream, Out); } if (Command != "students" && Command != "items"){ List.CheckStudent(Out, Cstream, Istream, Sstream, StudentNumber, Command); List.PrintEmail(Cstream, Istream, Sstream, Out, StudentNumber); } } // Add either a student or an item if (Command == "add"){ Cstream >> Command; // If command is student then do it for students if (Command == "student"){ Out << "add student" << endl; while (Command != At3){ Cstream >> At2; getline(Cstream, Command, '\n'); while (Cstream.peek() != At && Command != At3){ if (Command == "Name:"){ getline(Cstream, Name, '\n'); } if (Command == "Phone Number:"){ Cstream >> Left >> Area >> Right >> First >> Dash >> Last; } if (Command == "E-mail:"){ Cstream >> Email; } if (Command == "Address Line 1:"){ getline(Cstream, AddLine1, '\n'); } if (Command == "Address Line 2:"){ getline(Cstream, AddLine2, '\n'); } if (Command == "City:"){ getline(Cstream, City, '\n'); } if (Command == "State:"){ Cstream >> State; } if (Command == "Zipcode:"){ Cstream >> Zip; } if (Command == "Other:"){ getline(Cstream, Other, '\n'); } Cstream >> At2; getline(Cstream, Command, '\n'); } if (Command == At3){ List.AddStudent(Cstream, Istream, Sstream, Out, Name, Area, First, Last, Email, AddLine1, AddLine2, City, State, Zip, Other); Out << "Success" << endl; } } } // If command is item, do it for items if (Command == "item"){ Out << "add item" << endl; while (Command != At3){ Cstream >> At2; getline(Cstream, Command, '\n'); while (Cstream.peek() != At && Command != At3){ if (Command == "Item:"){ getline(Cstream, Item, '\n'); } if (Command == "Media Type:"){ getline(Cstream, Type, '\n'); } if (Command == "by:"){ getline(Cstream, By, '\n'); } if (Command == "Owner:"){ getline(Cstream, Owner, '\n'); } if (Command == "Price:"){ Cstream >> At2 >> Price; } if (Command == "Availability:"){ getline(Cstream, Availability, '\n'); } Cstream >> At2; getline(Cstream, Command, '\n'); } if (Command == At3){ List.AddItem(Cstream, Istream, Sstream, Out, Item, Type, By, Owner, Price, Availability); Out << "Success" << endl; } } } } } Sstream.close(); Istream.close(); Cstream.close(); Out.close(); return 0; }