JamesDamico

BCS 230 - Final Project

Apr 18th, 2019
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 18.50 KB | None | 0 0
  1. #include "pch.h"
  2. #include <iostream>
  3. #include <string>
  4. #include <fstream>
  5.  
  6. using namespace std;
  7.  
  8. /////////////////////////////////////
  9. //// PersonalInfo
  10. ////////////////////////////////////
  11. class PersonalInfo {
  12. private:
  13.     string birthDate;
  14.     string gender;
  15. public:
  16.     PersonalInfo(string birth = "none", string gend = "none")
  17.     {
  18.         birthDate = birth;
  19.         gender = gend;
  20.     }
  21.  
  22.     void setBirthDate(string b)
  23.     {
  24.         birthDate = b;
  25.     }
  26.  
  27.     string getBirthDate()
  28.     {
  29.         return birthDate;
  30.     }
  31.  
  32.     void setGender(string g)
  33.     {
  34.         gender = g;
  35.     }
  36.  
  37.     string getGender()
  38.     {
  39.         return gender;
  40.     }
  41.  
  42.     void printPersonalInfo()
  43.     {
  44.         cout << "Birth Date: " << birthDate << endl;
  45.         cout << "Gender: " << gender << endl;
  46.     }
  47.  
  48.     void printToFilePersonalInfo()
  49.     {
  50.         cout << birthDate << "," << gender;
  51.     }
  52. };
  53.  
  54. /////////////////////////////////////
  55. //// ContactInfo
  56. ////////////////////////////////////
  57. class ContactInfo {
  58. private:
  59.     string phoneInfo;
  60.     string emailInfo;
  61. public:
  62.     ContactInfo(string phone = "none", string email = "none")
  63.     {
  64.         phoneInfo = phone;
  65.         emailInfo = email;
  66.     }
  67.  
  68.     void setPhoneInfo(string p)
  69.     {
  70.         phoneInfo = p;
  71.     }
  72.  
  73.     string getPhoneInfo()
  74.     {
  75.         return phoneInfo;
  76.     }
  77.  
  78.     void setEmailInfo(string e)
  79.     {
  80.         emailInfo = e;
  81.     }
  82.  
  83.     string getEmailInfo()
  84.     {
  85.         return emailInfo;
  86.     }
  87.  
  88.     void printContactInfo()
  89.     {
  90.         cout << "Phone Info: " << phoneInfo << endl;
  91.         cout << "Email Info: " << emailInfo << endl;
  92.     }
  93.  
  94.     void printToFileContactInfo()
  95.     {
  96.         cout << phoneInfo << "," << emailInfo;
  97.     }
  98. };
  99.  
  100. /////////////////////////////////////
  101. //// HomeInfo
  102. ////////////////////////////////////
  103. class HomeInfo {
  104. private:
  105.     int streetNumber;
  106.     string street;
  107.     string city;
  108.     string state;
  109.     int zipCode;
  110.  
  111. public:
  112.     HomeInfo(int streetNum = 0, string str = "none", string cit = "none", string stat = "none", int zip = 0)
  113.     {
  114.         streetNumber = streetNum;
  115.         street = str;
  116.         city = cit;
  117.         state = stat;
  118.         zipCode = zip;
  119.     }
  120.  
  121.     void setStreetNumber(int s)
  122.     {
  123.         streetNumber = s;
  124.     }
  125.  
  126.     int getStreetNumber()
  127.     {
  128.         return streetNumber;
  129.     }
  130.  
  131.     void setStreet(string s)
  132.     {
  133.         street = s;
  134.     }
  135.  
  136.     string getStreet()
  137.     {
  138.         return street;
  139.     }
  140.  
  141.     void setCity(string c)
  142.     {
  143.         city = c;
  144.     }
  145.  
  146.     string getCity()
  147.     {
  148.         return city;
  149.     }
  150.  
  151.     void setState(string s)
  152.     {
  153.         state = s;
  154.     }
  155.  
  156.     string getState()
  157.     {
  158.         return state;
  159.     }
  160.  
  161.     void setZipCode(int z)
  162.     {
  163.         zipCode = z;
  164.     }
  165.  
  166.     int getZipCode()
  167.     {
  168.         return zipCode;
  169.     }
  170.  
  171.     void printHomeInfo()
  172.     {
  173.         cout << "Address: " << streetNumber << " " << street << ", " << city << ", " << state << " " << zipCode << endl;
  174.     }
  175.  
  176.     void printToFileHomeInfo()
  177.     {
  178.         cout << streetNumber << "," << street << "," << state << "," << zipCode;
  179.     }
  180. };
  181.  
  182. /////////////////////////////////////
  183. //// Person
  184. ////////////////////////////////////
  185. class Person {
  186. private:
  187.     string firstName;
  188.     string lastName;
  189.     PersonalInfo personal;
  190.     ContactInfo contact;
  191.     HomeInfo home;
  192.  
  193. public:
  194.  
  195.     Person(string first = "none", string last = "none", string birth = "none", string gend = "none", int streetNum = 0, string str = "none", string cit = "none", string stat = "none", int zip = 0, string phone = "none", string email = "none")
  196.         : personal(birth, gend),
  197.         contact(phone, email),
  198.         home(streetNum, str, cit, stat, zip)
  199.     {
  200.         firstName = first;
  201.         lastName = last;
  202.     }
  203.  
  204.     //No Home Info Constructor
  205.     Person(string first = "none", string last = "none", string birth = "none", string gend = "none", string phone = "none", string email = "none")
  206.         : personal(birth, gend),
  207.         contact(phone, email)
  208.     {
  209.         firstName = first;
  210.         lastName = last;
  211.     }
  212.  
  213.     void setFirstName(string f)
  214.     {
  215.         firstName = f;
  216.     }
  217.  
  218.     string getFirstName()
  219.     {
  220.         return firstName;
  221.     }
  222.  
  223.     void setLastName(string l)
  224.     {
  225.         lastName = l;
  226.     }
  227.  
  228.     string getLastName()
  229.     {
  230.         return lastName;
  231.     }
  232.  
  233.     PersonalInfo getPersonalInfo()
  234.     {
  235.         return personal;
  236.     }
  237.  
  238.     ContactInfo getContactInfo()
  239.     {
  240.         return contact;
  241.     }
  242.  
  243.     HomeInfo getHomeInfo()
  244.     {
  245.         return home;
  246.     }
  247.  
  248.     void print()
  249.     {
  250.         cout << "First Name: " << firstName << endl;
  251.         cout << "Last Name: " << lastName << endl;
  252.         personal.printPersonalInfo();
  253.         contact.printContactInfo();
  254.         home.printHomeInfo();
  255.     }
  256.  
  257.     void printWithOutHome()
  258.     {
  259.         cout << "First Name: " << firstName << endl;
  260.         cout << "Last Name: " << lastName << endl;
  261.         personal.printPersonalInfo();
  262.         contact.printContactInfo();
  263.     }
  264. };
  265.  
  266. /////////////////////////////////////
  267. //// Patient
  268. ////////////////////////////////////
  269. class Patient : public Person
  270. {
  271. private:
  272.     int patientID;
  273.     int doctorID;
  274.  
  275.  
  276. public:
  277.  
  278.     Patient(string first = "none", string last = "none", int patient = 0, int doctor = 0, string birth = "none", string gend = "none", int streetNum = 0, string str = "none", string cit = "none", string stat = "none", int zip = 0, string phone = "none", string email = "none")
  279.         : Person(first, last, birth, gend, streetNum, str, cit, stat, zip, phone, email)
  280.     {
  281.         patientID = patient;
  282.         doctorID = doctor;
  283.     }
  284.  
  285.     void setDoctorID(int d)
  286.     {
  287.         doctorID = d;
  288.     }
  289.  
  290.     int getDoctorID()
  291.     {
  292.         return doctorID;
  293.     }
  294.  
  295.     void setPatientID(int p)
  296.     {
  297.         patientID = p;
  298.     }
  299.  
  300.     int getPatientID()
  301.     {
  302.         return patientID;
  303.     }
  304.  
  305.     void print()
  306.     {
  307.         cout << "Patient ID: " << patientID << endl;
  308.         cout << "Doctor ID: " << doctorID << endl;
  309.         Person::print();
  310.     }
  311. };
  312.  
  313.  
  314. /////////////////////////////////////
  315. //// Staff
  316. ////////////////////////////////////
  317. class Staff : public Person
  318. {
  319. private:
  320.     string staffType;
  321.     int staffID;
  322.     int departmentID;
  323. public:
  324.     Staff(string staffT = "none", string first = "none", string last = "none", int staffI = 0, int departmentI = 0, string birth = "none", string gend = "none", string phone = "none", string email = "none")
  325.         : Person(first, last, birth, gend, phone, email)
  326.     {
  327.         staffType = staffT;
  328.         staffID = staffI;
  329.         departmentID = departmentI;
  330.     }
  331.  
  332.     void setStaffType(string staffTy)
  333.     {
  334.         staffType = staffTy;
  335.     }
  336.  
  337.     string getStaffType()
  338.     {
  339.         return staffType;
  340.     }
  341.  
  342.     void setStaffID(int staffI)
  343.     {
  344.         staffID = staffI;
  345.     }
  346.  
  347.     int getStaffID()
  348.     {
  349.         return staffID;
  350.     }
  351.  
  352.     void setDepartmentID(int deptID)
  353.     {
  354.         departmentID = deptID;
  355.     }
  356.  
  357.     int getDepartmentID()
  358.     {
  359.         return departmentID;
  360.     }
  361.  
  362.     void print()
  363.     {
  364.         cout << "Staff Type: " << staffType << endl;
  365.         cout << "Staff ID: " << staffID << endl;
  366.         cout << "Department ID: " << departmentID << endl;
  367.         Person::printWithOutHome();
  368.     }
  369. };
  370.  
  371. struct Department
  372. {
  373.     string departmentName;
  374.     int departmentID;
  375.  
  376.     Department(string dName = "none", int deptID = 0)
  377.     {
  378.         departmentName = dName;
  379.         departmentID = deptID;
  380.     }
  381. };
  382.  
  383. void departmentMenu();
  384. void staffMenu();
  385. void patientMenu();
  386. /////////////////////////////////////
  387. //// Main
  388. ////////////////////////////////////
  389. int main()
  390. {
  391.  
  392.     char selection;
  393.  
  394.     do
  395.     {
  396.         cout << " Main Menu" << endl;;
  397.         cout << " ====================================" << endl;
  398.         cout << " 1. Department Menu" << endl;
  399.         cout << " 2. Staff Menu" << endl;
  400.         cout << " 3. Patient Menu " << endl;
  401.         cout << " 4. Exit" << endl;
  402.         cout << " ====================================" << endl;;
  403.         cout << " Enter your selection: ";
  404.         cin >> selection;
  405.         cin.ignore();
  406.         cout << endl;
  407.  
  408.         switch (selection)
  409.         {
  410.         case '1':
  411.             departmentMenu();
  412.             system("cls");
  413.             break;
  414.  
  415.         case '2':
  416.             staffMenu();
  417.             system("cls");
  418.             break;
  419.  
  420.         case '3':
  421.             patientMenu();
  422.             system("cls");
  423.             break;
  424.  
  425.         case '4':
  426.             cout << "Goodbye." << endl;
  427.             system("pause");
  428.             return 0;
  429.         default: cout << selection << " is not a valid menu item." << endl;
  430.             cout << endl;
  431.         }
  432.     } while (selection != '4');
  433.  
  434.     return 0;
  435. }
  436.  
  437. /////////////////////////////////////
  438. //// Department Menu
  439. ////////////////////////////////////
  440. void departmentMenu()
  441. {
  442.     ifstream dFile;
  443.     ofstream outFile;
  444.     dFile.open("d.txt");
  445.     const int dSIZE = 10;
  446.     string deptName;
  447.     int deptID;
  448.     int dCount = 0;
  449.  
  450.     Department departments[dSIZE];
  451.     if (dFile.fail())
  452.     {
  453.         cout << "Error in opening the department file. ";
  454.         system("pause");
  455.     }
  456.     else
  457.     {
  458.         while (getline(dFile, deptName, ','))
  459.         {
  460.             dFile >> deptID;
  461.             dFile.ignore();
  462.  
  463.             departments[dCount].departmentName = deptName;
  464.             departments[dCount].departmentID = deptID;
  465.             dCount++;
  466.         }
  467.     }
  468.  
  469.     char selection;
  470.     do
  471.     {
  472.         system("cls");
  473.         cout << " Department Menu" << endl;
  474.         cout << " ====================================\n";
  475.         cout << " 1. List all departments" << endl;
  476.         cout << " 2. Add one department" << endl;
  477.         cout << " 3. Search one department " << endl;
  478.         cout << " 4. Edit one department *Not Implemented" << endl;
  479.         cout << " 5. Delete one department *Not Implemented" << endl;
  480.         cout << " 6. Return to main menu" << endl;
  481.         cout << " ====================================" << endl;
  482.         cout << " Enter your selection: " << endl;
  483.         cin >> selection;
  484.         cin.ignore();
  485.         cout << endl;
  486.  
  487.         switch (selection)
  488.         {
  489.         case '1':
  490.            
  491.             for (int i = 0; i < dCount; i++)
  492.             {
  493.                 cout << departments[i].departmentName << ", " << departments[i].departmentID << endl;
  494.             }
  495.            
  496.             system("pause");
  497.             system("cls");
  498.             break;
  499.  
  500.         case '2':
  501.            
  502.             if (dCount <= dSIZE)
  503.             {
  504.                 cout << "Enter department name: " << endl;
  505.                 getline(cin, departments[dCount].departmentName);
  506.  
  507.                 cout << "Enter department ID: " << endl;
  508.                 cin >> departments[dCount].departmentID;
  509.                 cin.ignore();
  510.                 dCount++;
  511.             }
  512.             else
  513.             {
  514.                 cout << "There is no more room!";
  515.             }
  516.             system("pause");
  517.             system("cls");
  518.             break;
  519.  
  520.         case '3':
  521.             int searchID;
  522.  
  523.             cout << "Enter Department ID: " << endl;
  524.             cin >> searchID;
  525.             cin.ignore();
  526.  
  527.             for (int i = 0; i < dCount; i++)
  528.             {
  529.                 if (departments[i].departmentID == searchID)
  530.                 {
  531.                     cout << departments[i].departmentName << ", " << departments[i].departmentID << endl;
  532.                 }
  533.             }
  534.             system("pause");
  535.             system("cls");
  536.             break;
  537.  
  538.         case '4':
  539.             cout << "Sorry, this feature isn't implemented yet.";
  540.             system("cls");
  541.             break;
  542.  
  543.         case '5':
  544.             cout << "Sorry, this feature isn't implemented yet.";
  545.             system("cls");
  546.             break;
  547.  
  548.         case '6':
  549.             outFile.open("d.txt");
  550.             if (outFile)
  551.             {
  552. //              cout << "Debug!!!" << endl;
  553. //              system("pause");
  554.                 for (int i = 0; i < dCount; i++)
  555.                 {
  556.                     outFile << departments[i].departmentName << ", " << departments[i].departmentID << endl;
  557.                 }
  558.             }
  559.             outFile.close();
  560.             system("cls");
  561.             return;
  562.         default: cout << selection << " is not a valid menu item." << endl;
  563.             cout << endl;
  564.         }
  565.     } while (selection != '6');
  566. }
  567.  
  568. /////////////////////////////////////
  569. //// Patient Menu
  570. ////////////////////////////////////
  571. void patientMenu()
  572. {
  573.     ifstream pFile;
  574.     ofstream outFile;
  575.     pFile.open("p.txt");
  576.  
  577.     string pFirst;
  578.     string pLast;
  579.     int pPatientID;
  580.     int pDoctorID;
  581.     string pBirthDate;
  582.     string pGender;
  583.     int pStreetNumber;
  584.     string pStreet;
  585.     string pCity;
  586.     string pState;
  587.     int pZip;
  588.     string pPhoneNumber;
  589.     string pEmail;
  590.  
  591.     const int pSIZE = 10;
  592.     int pCount = 0;
  593.     Patient patients[pSIZE];
  594.     if (pFile.fail())
  595.     {
  596.         cout << "Error in opening the patient file. ";
  597.         system("pause");
  598.     }
  599.     else
  600.     {
  601.         while (getline(pFile, pFirst, ','))
  602.         {
  603.             getline(pFile, pLast, ',');
  604.             pFile >> pPatientID;
  605.             pFile.ignore();
  606.             pFile >> pDoctorID;
  607.             pFile.ignore();
  608.             getline(pFile, pBirthDate, ',');
  609.             getline(pFile, pGender, ',');
  610.             pFile >> pStreetNumber;
  611.             pFile.ignore();
  612.             getline(pFile, pStreet, ',');
  613.             getline(pFile, pCity, ',');
  614.             getline(pFile, pState, ',');
  615.             pFile >> pZip;
  616.             pFile.ignore();
  617.             getline(pFile, pPhoneNumber, ',');
  618.             getline(pFile, pEmail);
  619.  
  620.             patients[pCount] = { pFirst, pLast, pPatientID, pDoctorID, pBirthDate, pGender, pStreetNumber, pStreet, pCity, pState, pZip, pPhoneNumber, pEmail };
  621.             pCount++;
  622.         }
  623.         pFile.close();
  624.     }
  625.  
  626.     char selection;
  627.  
  628.     do
  629.     {
  630.         system("cls");
  631.         cout << " Patients Menu" << endl;
  632.         cout << " ====================================" << endl;
  633.         cout << " 1. List all patients" << endl;
  634.         cout << " 2. Add one patients" << endl;
  635.         cout << " 3. Search one patients " << endl;
  636.         cout << " 4. Edit one patients *Not Implemented" << endl;
  637.         cout << " 5. Delete one patients *Not Implemented" << endl;
  638.         cout << " 6. Return to main menu" << endl;
  639.         cout << " ====================================" << endl;
  640.         cout << " Enter your selection: ";
  641.         cin >> selection;
  642.         cin.ignore();
  643.         cout << endl;
  644.  
  645.         switch (selection)
  646.         {
  647.         case '1':
  648.             for (int i = 0; i < pCount; i++)
  649.             {
  650.                 patients[i].print();
  651.                 cout << " " << endl;
  652.                 cout << " " << endl;
  653.                 cout << " " << endl;
  654.             }
  655.             system("pause");
  656.             system("cls");
  657.             break;
  658.  
  659.         case '2':
  660.  
  661.             if (pCount <= pSIZE)
  662.             {
  663.                 cout << "Enter First Name: " << endl;
  664.                 getline(cin, pFirst);
  665.  
  666.                 cin.clear();
  667.                 cout << "Enter Last Name: " << endl;
  668.                 getline(cin, pLast);
  669.  
  670.                 cin.clear();
  671.                 cout << "Enter Patient ID: " << endl;
  672.                 cin >> pPatientID;
  673.                 cin.ignore();
  674.  
  675.                 cout << "Enter Doctor ID: " << endl;
  676.                 cin >> pDoctorID;
  677.                 cin.ignore();
  678.  
  679.                 cout << "Enter BirthDay: " << endl;
  680.                 getline(cin, pBirthDate);
  681.  
  682.                 cout << "Enter Gender: " << endl;
  683.                 getline(cin, pGender);
  684.  
  685.                 cout << "Enter Home Number: " << endl;
  686.                 cin >> pStreetNumber;
  687.                 cin.ignore();
  688.  
  689.                 cout << "Enter Street: " << endl;
  690.                 getline(cin, pStreet);
  691.  
  692.                 cout << "Enter State: " << endl;
  693.                 getline(cin, pState);
  694.  
  695.                 cout << "Enter Zip Code: " << endl;
  696.                 cin >> pZip;
  697.                 cin.ignore();
  698.  
  699.                 cout << "Enter Phone Number: " << endl;
  700.                 getline(cin, pPhoneNumber);
  701.  
  702.                 cout << "Enter Email Address: " << endl;
  703.                 getline(cin, pEmail);
  704.  
  705.                 patients[pCount] = { pFirst, pLast, pPatientID, pDoctorID, pBirthDate, pGender, pStreetNumber, pStreet, pCity, pState, pZip, pPhoneNumber, pEmail };               
  706.                 pCount++;
  707.             }
  708.             system("pause");
  709.             system("cls");
  710.             break;
  711.  
  712.         case '3':
  713.             int searchID;
  714.  
  715.             cout << "Enter Staff ID: " << endl;
  716.             cin >> searchID;
  717.             cin.ignore();
  718.  
  719.             for (int i = 0; i < pCount; i++)
  720.             {
  721.                 if (patients[i].getPatientID() == searchID)
  722.                 {
  723.                     patients[i].print();
  724.                 }
  725.             }
  726.             system("pause");
  727.             system("cls");
  728.             break;
  729.  
  730.         case '4':
  731.             cout << "Sorry, this feature isn't implemented yet.";
  732.             system("cls");
  733.             break;
  734.  
  735.         case '5':
  736.             cout << "Sorry, this feature isn't implemented yet.";
  737.             system("cls");
  738.             break;
  739.  
  740.         case '6':
  741.             /*
  742.             outFile.open("p.txt");
  743.             if (outFile)
  744.             {
  745.                 cout << "Debug!!!" << endl;
  746.                 system("pause");
  747.                 for (int i = 0; i < pCount; i++)
  748.                 {
  749. //                  outFile << patients[i].getFirstName() << "," << patients[i].getLastName() << "," << patients[i].getPatientID() << "," << patients[i].getDoctorID() << "," << patients[i].getPersonalInfo().printToFilePersonalInfo() << "," << patients[i].getHomeInfo().printToFileHomeInfo() << "," << patients[i].getContactInfo().printContactInfo();
  750.                 }
  751.             }
  752.             outFile.close();
  753.             */
  754.             system("cls");
  755.             return;
  756.         default: cout << selection << " is not a valid menu item." << endl;
  757.             cout << endl;
  758.         }
  759.     } while (selection != '6');
  760.  
  761. }
  762.  
  763. /////////////////////////////////////
  764. //// Staff Menu
  765. ////////////////////////////////////
  766. void staffMenu()
  767. {
  768.     ifstream sFile;
  769.     sFile.open("s.txt");
  770.  
  771.     string sType;
  772.     string sFirst;
  773.     string sLast;
  774.     int sStaffID;
  775.     int sDepartmentID;
  776.     string sBirth;
  777.     string sGender;
  778.     string sPhone;
  779.     string sEmail;
  780.  
  781.     const int sSIZE = 10;
  782.     int sCount = 0;
  783.     Staff staff[sSIZE];
  784.     if (sFile.fail())
  785.     {
  786.         cout << "Error in opening the staff file." << endl;
  787.         system("pause");
  788.     }
  789.     else
  790.     {
  791.         while (getline(sFile, sType, ','))
  792.         {
  793.             getline(sFile, sFirst, ',');
  794.             getline(sFile, sLast, ',');
  795.             sFile >> sStaffID;
  796.             sFile.ignore();
  797.             sFile >> sDepartmentID;
  798.             sFile.ignore();
  799.             getline(sFile, sBirth, ',');
  800.             getline(sFile, sGender, ',');
  801.             getline(sFile, sPhone, ',');
  802.             getline(sFile, sEmail);
  803.  
  804.             staff[sCount] = { sType, sFirst, sLast, sStaffID, sDepartmentID, sBirth, sGender, sPhone, sEmail };
  805.             sCount++;
  806.         }
  807.         sFile.close();
  808.     }
  809.  
  810.     char selection;
  811.  
  812.     do
  813.     {
  814.         system("cls");
  815.         cout << " Staff Menu" << endl;
  816.         cout << " ====================================" << endl;
  817.         cout << " 1. List all staff" << endl;
  818.         cout << " 2. Add one staff" << endl;
  819.         cout << " 3. Search one staff " << endl;
  820.         cout << " 4. Edit one staff *Not Implemented" << endl;
  821.         cout << " 5. Delete one staff *Not Implemented" << endl;
  822.         cout << " 6. Return to main menu" << endl;
  823.         cout << " ====================================" << endl;
  824.         cout << " Enter your selection: ";
  825.         cin >> selection;
  826.         cin.ignore();
  827.         cout << endl;
  828.  
  829.         switch (selection)
  830.         {
  831.         case '1':
  832.             for (int i = 0; i < sCount; i++)
  833.             {
  834.                 staff[i].print();
  835.                 cout << " " << endl;
  836.                 cout << " " << endl;
  837.                 cout << " " << endl;
  838.             }
  839.             system("pause");
  840.             system("cls");
  841.             break;
  842.  
  843.         case '2':
  844.  
  845.             if (sCount <= sSIZE)
  846.             {
  847.                 cout << "Enter Staff Type: \nD - Doctor \nN - Nurse \nA - Administrative Personel" << endl;
  848.                 getline(cin, sType);
  849.  
  850.                 cout << "Enter First Name: " << endl;
  851.                 getline(cin, sFirst);
  852.  
  853.                 cin.clear();
  854.                 cout << "Enter Last Name: " << endl;
  855.                 getline(cin, sLast);
  856.  
  857.                 cin.clear();
  858.                 cout << "Enter Staff ID: " << endl;
  859.                 cin >> sStaffID;
  860.                 cin.ignore();
  861.  
  862.                 cout << "Enter Department ID: " << endl;
  863.                 cin >> sDepartmentID;
  864.                 cin.ignore();
  865.  
  866.                 cout << "Enter BirthDay: " << endl;
  867.                 getline(cin, sBirth);
  868.  
  869.                 cout << "Enter Gender: " << endl;
  870.                 getline(cin, sGender);
  871.  
  872.                 cout << "Enter Phone Number: " << endl;
  873.                 getline(cin, sPhone);
  874.  
  875.                 cout << "Enter Email Address: " << endl;
  876.                 getline(cin, sEmail);
  877.  
  878.                 staff[sCount] = { sType, sFirst, sLast, sStaffID, sDepartmentID, sBirth, sGender, sPhone, sEmail };            
  879.                 sCount++;
  880.             }
  881.             system("pause");
  882.             system("cls");
  883.             break;
  884.  
  885.         case '3':
  886.            
  887.             int searchID;
  888.  
  889.             cout << "Enter Staff ID: " << endl;
  890.             cin >> searchID;
  891.             cin.ignore();
  892.  
  893.             for (int i = 0; i < sCount; i++)
  894.             {
  895.                 if (staff[i].getStaffID() == searchID)
  896.                 {
  897.                     staff[i].print();
  898.                 }
  899.             }
  900.  
  901.             system("pause");
  902.             system("cls");
  903.             break;
  904.  
  905.         case '4':
  906.             cout << "Sorry, this feature isn't implemented yet.";
  907.             system("cls");
  908.             break;
  909.  
  910.         case '5':
  911.             cout << "Sorry, this feature isn't implemented yet.";
  912.             system("cls");
  913.             break;
  914.  
  915.         case '6':
  916.             /*
  917.             outFile.open("s.txt");
  918.             if (outFile)
  919.             {
  920.                 cout << "Debug!!!" << endl;
  921.                 system("pause");
  922.                 for (int i = 0; i < sCount; i++)
  923.                 {
  924.  
  925.                 }
  926.             }
  927.             outFile.close();
  928.             */
  929.             system("cls");
  930.             return;
  931.         default: cout << selection << " is not a valid menu item." << endl;
  932.             cout << endl;
  933.         }
  934.     } while (selection != '3');
  935.  
  936. }
Add Comment
Please, Sign In to add comment