31
|
1 |
|
|
2 |
|
|
3 |
|
|
4 |
// STLport regression testsuite component.
|
|
5 |
// To compile as a separate example, please #define MAIN.
|
|
6 |
#include <algorithm>
|
|
7 |
#include <iostream>
|
|
8 |
|
|
9 |
|
|
10 |
#ifdef MAIN
|
|
11 |
#define alg2_test main
|
|
12 |
#endif
|
|
13 |
|
|
14 |
#if !defined (STLPORT) || defined(__STL_USE_NAMESPACES)
|
|
15 |
using namespace std;
|
|
16 |
#endif
|
|
17 |
int alg2_test(int, char**)
|
|
18 |
{
|
|
19 |
|
|
20 |
cout<<"Results of alg2_test:"<<endl;
|
|
21 |
int n = 0;
|
|
22 |
int i [] = { 1, 4, 2, 8, 2, 2 };
|
|
23 |
|
|
24 |
count(i, i + 6, 2, n);
|
|
25 |
cout << "Count of 2s = " << n << endl;
|
|
26 |
|
|
27 |
if (n == 3)
|
|
28 |
return 0;
|
|
29 |
else
|
|
30 |
return 1;
|
|
31 |
}
|