Advertisement
Guest User

Untitled

a guest
Jan 28th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. void sortiraj(int a[], int n, char e)
  2. {
  3.     int temp;
  4.     for(int i=0;i<n;i++)
  5.     {
  6.         for(int j=n;j>i;j--)
  7.         {
  8.             if(e == '>')
  9.             {
  10.                 if(a[j]<a[j-1])
  11.                 {
  12.                     temp = a[j];
  13.                     a[j] = a[j-1];
  14.                     a[j-1] = temp;
  15.                 }
  16.             }
  17.             else
  18.             {
  19.                 if(a[j]>a[j-1])
  20.                 {
  21.                     temp = a[j];
  22.                     a[j] = a[j-1];
  23.                     a[j-1] = temp;
  24.                 }
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement