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