Pushok

Untitled

Apr 10th, 2014
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.47 KB | None | 0 0
  1. void SortGr(int* arr, int a, int b)
  2. {
  3.     for (int i = a; i < b - 1; ++i)
  4.     {
  5.         for (int j = b - 2; j >= i; --j)
  6.         {
  7.             if (arr[j] > arr[j + 1])
  8.             {
  9.                 int t = arr[j];
  10.                 arr[j] = arr[j + 1];
  11.                 arr[j + 1] = t;
  12.             }
  13.         }
  14.     }
  15. }
  16.  
  17. void SortLe(int* arr, int a, int b)
  18. {
  19.     for (int i = a; i < b - 1; ++i)
  20.     {
  21.         for (int j = b - 2; j >= i; --j)
  22.         {
  23.             if (arr[j] < arr[j + 1])
  24.             {
  25.                 int t = arr[j];
  26.                 arr[j] = arr[j + 1];
  27.                 arr[j + 1] = t;
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment