home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / test / regression / accum1.cpp next >
C/C++ Source or Header  |  2001-06-28  |  535b  |  27 lines

  1. // STLport regression testsuite component.
  2. // To compile as a separate example, please #define MAIN.
  3.  
  4. #include <vector>
  5. #include <numeric>
  6. #include <iostream>
  7.  
  8. #ifdef MAIN 
  9. #define accum1_test main
  10. #endif
  11.  
  12. #if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
  13. using namespace std;
  14. #endif
  15.  
  16.  
  17. int accum1_test(int, char**)
  18. {
  19.   cout<<"Results of accum1_test:"<<endl;
  20.   vector <int> v(5);
  21.   for(int i = 0; i < v.size(); i++)
  22.     v[i] = i + 1;
  23.   int sum = accumulate(v.begin(), v.end(), 0);
  24.   cout << "sum = " << sum << endl;
  25.   return 0;
  26. }
  27.