• Source
    1. #include <iostream>
    2. #include <algorithm>
    3. #include <bits/stdc++.h>
    4.  
    5. using namespace std;
    6.  
    7. int main() {
    8.  
    9. vector <int> temp;
    10.  
    11. temp.push_back(40);
    12. temp.push_back(20);
    13. temp.push_back(50);
    14. temp.push_back(10);
    15.  
    16. cout << "vector list : ";
    17. for(auto i:temp )
    18. cout << i << " ";
    19. cout << endl;
    20.  
    21. sort( temp.begin(), temp.end() );
    22. cout << "vector list after sort : ";
    23. for(auto i:temp )
    24. cout << i << " ";
    25. cout << endl;
    26.  
    27. // your code goes here
    28. return 0;
    29. }