Advertisement
NHumme

Untitled

Mar 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <set>
  4. #include <algorithm>
  5. using namespace std;
  6. int n;
  7. struct chel {
  8.     string na, fa, cl, d;
  9. };
  10. bool  operator< (chel a, chel b)
  11. {
  12.     if (a.cl < b.cl) {
  13.         return true;
  14.     }
  15.     if (a.cl == b.cl && a.fa <= b.fa) {
  16.         return true;
  17.     }
  18.     return false;
  19. }
  20. chel c;
  21. set < chel > a;
  22. int main()
  23. {
  24.     cin >> n;
  25.     for (int i = 0; i < n; i++) {
  26.         cin >> c.fa >> c.na >> c.cl >> c.d;
  27.         a.insert(c);
  28.     }
  29.    
  30.     for (std::set<chel>::iterator i = a.begin(); i != a.end(); i++)
  31.         cout << i->cl << " " << i->fa << " " << i->na << " " << i->d << "\n";
  32.  
  33.  
  34.  
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement