Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <iostream>
- #include <string.h>
- #include <queue>
- using namespace std;
- struct Workers {
- char fio[50];
- char date_bir[50];
- char home_a_dress[50];
- char speshial[50];
- int stag_rabot;
- };
- void debug() {
- cin.clear();
- while(cin.get() != '\n');
- return;
- }
- int main() {
- queue<Workers> in;
- queue<Workers> out;
- Workers tmp;
- for(int i = 0; i < 2; i++) {
- cout << "fio" << endl;
- cin.getline(tmp.fio, 50);
- cout << "date_bir" << endl;
- cin.getline(tmp.date_bir, 50);
- cout << "home_a_dress" << endl;
- cin.getline(tmp.home_a_dress, 50);
- cout << "speshial" << endl;
- cin.getline(tmp.speshial, 50);
- cout << "stag_rabot" << endl;
- while(!scanf("%d", &tmp.stag_rabot)) {
- debug();
- cout << "Vvedite shislo" << endl;
- }
- cout << endl;
- in.push(tmp);
- debug();
- }
- printf("|%20s|%20s|%20s|%25s|%12s|\n\n",
- "fio",
- "date_bir",
- "home_a_dress",
- "speshial",
- "stag_rabot");
- while(!in.empty()) {
- tmp = in.front();
- printf("|%20s|%20s|%20s|%25s|%12d|\n",
- tmp.fio,
- tmp.date_bir,
- tmp.home_a_dress,
- tmp.speshial,
- tmp.stag_rabot);
- if((tmp.stag_rabot > 10) && (strcmp(tmp.speshial, "ingener-sistemotechnic") == 0)) {
- out.push(tmp);
- }
- in.pop();
- }
- printf("\n\n|%20s|%12s|\n",
- "fio",
- "stag_rabot");
- while(!out.empty()) {
- tmp = out.front();
- printf("|%20s|%12d|\n",
- tmp.fio,
- tmp.stag_rabot);
- out.pop();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement