sort2.cpp

sort2.cpp

#include ‹stl.h›

#include ‹iostream.h›

int array[] = {1, 50, -10, 11, 42, 19};

int main() {

 int count = sizeof(array) / sizeof(array[0]);

 ostream_iterator ‹int› iter(cout, " ");

 cout ‹‹ "before: ";

 copy(array, array + count, iter);

 cout ‹‹ " after: ";

 sort(array, array + count, greater‹int›());

 copy(array, array + count, iter);

 cout ‹‹ endl;

 return 0;

}