home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stl453up.zip / stl453fx / test / regression / sort2.cpp < prev    next >
C/C++ Source or Header  |  2002-04-29  |  711b  |  31 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <algorithm>
  5. #include <iostream>
  6. #include <iterator>
  7. #include <functional>
  8.  
  9. #ifdef MAIN 
  10. #define sort2_test main
  11. #endif
  12.  
  13. #if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
  14. using namespace std;
  15. #endif
  16. int sort2_test(int, char**)
  17. {
  18.   cout<<"Results of sort2_test:"<<endl;
  19. int array[] = { 1, 50, -10, 11, 42, 19 };
  20.  
  21.   int count = sizeof(array) / sizeof(array[0]);
  22.   ostream_iterator <int> iter(cout, " ");
  23.   cout << "before: ";
  24.   copy(array, array + count, iter);
  25.   cout << "\nafter: ";
  26.   sort(array, array + count, greater<int>());
  27.   copy(array, array + count, iter);
  28.   cout << endl;
  29.   return 0;
  30. }
  31.