Advertisement
tabvn

Untitled

Jun 14th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <iostream>
  2. #include <algorithm>
  3.  
  4. using namespace std;
  5.  
  6. template<typename T>
  7. void mySort(T arr[], int n){
  8. sort(arr, arr+n, greater<T>());
  9. }
  10.  
  11. int main() {
  12.  
  13. int arr[5] = {1,2,3,4,5};
  14.  
  15. mySort(arr, 5);
  16.  
  17. for (int i = 0; i < 5; ++i) {
  18. cout << arr[i];
  19. }
  20.  
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement