Baxram97

Untitled

Feb 23rd, 2022 (edited)
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <queue>
  3.  
  4. using namespace std;
  5.  
  6. class worker {
  7. private:
  8.     int _id;
  9.     char *_name = nullptr;
  10.     char *_surname = nullptr;
  11.     int _age;
  12.     int _page_count;
  13.  
  14. public:
  15.     explicit worker(int id, char *nm, char *sn, int age, int pc)
  16.             : _id(id), _name(nm), _surname(sn), _age(age), _page_count(pc) {}
  17.  
  18.     void print_info() {
  19.         cout << "ID: " << _id << "\n"
  20.              << "Name: " << _name << "\n"
  21.              << "Surname: " << _surname << "\n"
  22.              << "Age: " << _age << "\n"
  23.              << "Page count: " << _page_count << std::endl
  24.              << std::endl;
  25.     }
  26. };
  27.  
  28. class worker_queue {
  29. private:
  30.     queue<worker> _workers;
  31.  
  32. public:
  33.     void start() {
  34.         while (!_workers.empty()) {
  35.             _workers.front().print_info();
  36.             _workers.pop();
  37.         }
  38.     }
  39. };
  40.  
  41. int main() {
  42.  
  43.     worker s(8312, "Bahram", "Bayramzade", 24, 97);
  44.     s.print_info();
  45.  
  46.     worker_queue().start();
  47.  
  48.     return 0;
  49. }
Add Comment
Please, Sign In to add comment