#include <iostream>
using namespace std;

typedef bool (*pf_Bool_IntInt)(int, int);
bool manje(int x, int y) {return (x < y);}
bool vece (int x, int y) {return (x > y);}
bool dulje(int x, int y) { /*return ....;*/}

void sortiraj(int* first, int* last, 
              pf_Bool_IntInt usporedi = manje) {
     int *pi, *pj, tmp;
     for (pi = first; pi <= last; ++pi)
         for (pj = pi; pj <= last; ++pj)
//             if (*pi > *pj) 
             if (usporedi(*pi,*pj))
                tmp = *pi, *pi = *pj, *pj = tmp;
}

int main() {
    int polje[] = {3,5,1,2,8,4,5,6};
    for (int i=0; i<8; ++i) cout << polje[i] << " "; cout << endl;
    sortiraj(polje, polje+7);
    for (int i=0; i<8; ++i) cout << polje[i] << " "; cout << endl;
    sortiraj(polje, polje+7, vece);
    for (int i=0; i<8; ++i) cout << polje[i] << " "; cout << endl;
    return 0;
}














