Advertisement
VictoriaLodochkina

lab 5.2 Z2

Mar 23rd, 2020
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.69 KB | None | 0 0
  1. /*Известна следующая информация об n заявках в сервисном центре по ремонту
  2. компьютерной техники(n – натуральное число) : наименование товара, дата
  3. поступления, описание неисправности, статус заявки(напр, «рассматривается»
  4. или «обработано»).Удалить все записи со статусом заявки «обработано».*/
  5. #include <iostream>
  6. #include <string>
  7. #include <vector>
  8. #include <algorithm>
  9.  
  10. using namespace std;
  11.  
  12. struct Information
  13. {
  14.     string Name;
  15.     string Date;
  16.     string Problem;
  17.     string Status;
  18. };
  19. int main()
  20. {
  21.     int n;
  22.     cout << "Enter n: " << endl;
  23.     cin >> n;
  24.     vector<Information> info(n);
  25.     cin.ignore(100, '\n');
  26.     cin.clear();
  27.     for (int i = 0; i < n; i++)
  28.     {
  29.         cout << "Fill list " << i+1 << ":" << endl << "Name: " << endl;
  30.         getline(cin, info.at(i).Name);
  31.         cout << "Date: " << endl;
  32.         getline(cin, info.at(i).Date);
  33.         cout << "Problem: " << endl;
  34.         getline(cin, info.at(i).Problem);
  35.         cout << "Status: " << endl;
  36.         getline(cin, info.at(i).Status);
  37.     }
  38.     for (int i = 0; i < info.size(); i++)
  39.     {
  40.         if (info.at(i).Status == "processed")
  41.         {
  42.             info.erase(info.begin() + i);
  43.         }
  44.     }
  45.     cout << "*******************************************************************" << endl;
  46.     cout << "Results: " << endl;
  47.     for (int i = 0; i < info.size(); i++)
  48.     {
  49.         cout << "List " << i + 1 << ":" << endl << info.at(i).Name << endl << info.at(i).Date << endl << info.at(i).Problem << endl << info.at(i).Status << endl;
  50.         cout << "             ***" << endl;
  51.     }
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement