SHARE
TWEET

zahachaNatashi

a guest Jan 21st, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top