Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <functional>
- using namespace std;
- int main()
- {
- vector<int> v;
- int x;
- while(cin >> x){
- v.push_back(x);
- }
- vector<int>::iterator it = max_element(v.begin(), v.end());
- cout << endl;
- cout <<"MaxElement = " << *it << endl;
- sort(v.begin(), it);
- sort(it, v.end(), greater<int>());
- for(vector<int>::iterator it = v.begin(); it != v.end(); it++){
- cout << *it <<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement