Advertisement
Md_hosen_zisad

sort function Ascending

Mar 18th, 2018
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.32 KB | None | 0 0
  1. #include<iostream>
  2. #include<algorithm>
  3. #include<vector>
  4. using namespace std;
  5. int main()
  6. {
  7.     int n,j,i,x;
  8.     cin>>n;
  9.     vector<int>ar;
  10.     for(i=0;i<n;i++)
  11.     {
  12.         cin>>x;
  13.         ar.push_back(x);
  14.     }
  15.   sort(ar.begin(),ar.end());
  16.  
  17. for(i=0;i<n;i++)
  18. {
  19.     cout<<ar[i]<<" ";
  20. }
  21.         return 0;
  22.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement