#include #include #include using namespace std; //-------------------------------------------------------------------- bool descendingOrder( int i, int j) { return (j& vec) { cout << "myvector contains:"; for (vector::iterator it=vec.begin(); it!=vec.end(); ++it) cout << ' ' << *it; cout << '\n'; } //-------------------------------------------------------------------- class ComparDescending { public: bool operator()(int i, int j) { return (i>j); } }; //-------------------------------------------------------------------- class ComparAscending { public: bool operator()(int i, int j) { return (i myvector (myints, myints+8); // 32 71 12 45 26 80 53 33 sort ( myvector.begin(), myvector.end(), ComparDescending() ); print( myvector ); sort ( myvector.begin(), myvector.end(), ComparAscending() ); print( myvector ); }