alg3.cpp
alg3.cpp
#include ‹iostream.h›
#include ‹stl.h›
int main() {
vector‹int› i;
i.push_back(1);
i.push_back(4);
i.push_back(2);
i.push_back(8);
i.push_back(2);
i.push_back(2);
int n = 0; // Must be initialized, as count increments n.
count(i.begin(), i.end(), 2, n);
cout ‹‹ "Count of 2s = " ‹‹ n ‹‹ endl;
return 0;
}