Advertisement
Guest User

zahachaNatashi

a guest
Jan 21st, 2020
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4. #include <functional>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.   vector<int> v;
  11.   int x;
  12.   while(cin >> x){
  13.     v.push_back(x);
  14.   }
  15.   vector<int>::iterator it = max_element(v.begin(), v.end());
  16.   cout << endl;
  17.   cout <<"MaxElement = " << *it << endl;
  18.   sort(v.begin(), it);
  19.   sort(it, v.end(), greater<int>());
  20.  
  21.   for(vector<int>::iterator it = v.begin(); it != v.end(); it++){
  22.     cout << *it <<" ";
  23.   }
  24.   return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement