Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <queue>
- using namespace std;
- class worker {
- private:
- int _id;
- char *_name = nullptr;
- char *_surname = nullptr;
- int _age;
- int _page_count;
- public:
- explicit worker(int id, char *nm, char *sn, int age, int pc)
- : _id(id), _name(nm), _surname(sn), _age(age), _page_count(pc) {}
- void print_info() {
- cout << "ID: " << _id << "\n"
- << "Name: " << _name << "\n"
- << "Surname: " << _surname << "\n"
- << "Age: " << _age << "\n"
- << "Page count: " << _page_count << std::endl
- << std::endl;
- }
- };
- class worker_queue {
- private:
- queue<worker> _workers;
- public:
- void start() {
- while (!_workers.empty()) {
- _workers.front().print_info();
- _workers.pop();
- }
- }
- };
- int main() {
- worker s(8312, "Bahram", "Bayramzade", 24, 97);
- s.print_info();
- worker_queue().start();
- return 0;
- }
Add Comment
Please, Sign In to add comment