Advertisement
erfanul007

Sort function

Nov 5th, 2019
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. scanf("%d",&n);
  8. int a[n+5];
  9. for(int i=0;i<n;i++){
  10. scanf("%d",&a[i]);
  11. }
  12. sort(a,a+n); //sorts from starting 0 index to n-1
  13. sort(a+1,a+n+1); //sorts from starting 1 index to n
  14. sort(a+2,a+5); //sorts from starting 2 index to 4
  15. return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement