Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string>
- #include <fstream>
- #include <queue>
- using namespace std;
- struct Employee
- {
- string F, I, O, gender;
- int age, sallary;
- void showInfo(ofstream& out)
- {
- out << F << " " << I << " " << O << " " << gender << " " << age << " " << sallary << endl;
- }
- };
- void printQueue(ofstream& out, queue<Employee> que)
- {
- while (que.size() != 0)
- {
- que.front().showInfo(out);
- que.pop();
- }
- }
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- int n;
- in >> n;
- queue<Employee> less10000;
- queue<Employee> more10000;
- for (int i = 0; i < n; ++i)
- {
- Employee obj;
- in >> obj.F >> obj.I >> obj.O >> obj.gender >> obj.age >> obj.sallary;
- if (obj.sallary < 10000) less10000.push(obj);
- else more10000.push(obj);
- }
- printQueue(out, less10000);
- printQueue(out, more10000);
- in.close();
- out.close();
- return 0;
- }
Add Comment
Please, Sign In to add comment