fork download
  1. #include <cstdlib>
  2. #include <iostream>
  3. #include <time.h>
  4. #include <string>
  5. #include <array>
  6. #include <iterator>
  7. #include <algorithm>
  8.  
  9. using namespace std;
  10.  
  11. class sorti
  12. {
  13. public:
  14. array<string,5> first;
  15. array<string,5> second;
  16. array<int,5> third;
  17.  
  18. void sortirovka();
  19. };
  20.  
  21. sorti mas_s[5],tmp;
  22. int i,n=5;
  23.  
  24. bool myfunction (int i,int j) { return (i<j); }
  25.  
  26. void sorti::sortirovka()
  27. {
  28. //Ввод данных
  29. for(i=0;i<n;i++)
  30. {
  31. getline(cin,mas_s[i].first[i]);
  32. cin >> mas_s[i].second[i];
  33. cin >> mas_s[i].third[i];
  34. cin.ignore();
  35. }
  36.  
  37. //Сортировка по array<int,5> third
  38.  
  39. sort(third.begin(), third.end(), myfunction);
  40.  
  41. for(i=0;i<n;i++)
  42. {
  43. cout << mas_s[i].first[i] << " " << mas_s[i].second[i] << " " << mas_s[i].third[i] << "\n";
  44. }
  45. }
  46.  
  47. int main() {
  48.  
  49. sorti so;
  50.  
  51. so.sortirovka();
  52.  
  53. system("pause");
  54.  
  55. return 0;
  56. }
Success #stdin #stdout #stderr 0s 15240KB
stdin
Standard input is empty
stdout
  0
  0
  0
  0
  0
stderr
sh: 1: pause: not found