CI
C++ Certified Professional Programmer
228 Questions
Question No. 1
"What happens when you attempt to compile and run the following code?
#include <iostream>
#include <algorithm>
#include <vector> using namespace std;
struct Compare {
bool operator ()(int a) { if (a >5) return true; return false;
}
};
int main () {
int t[] = {1,2,3,2,3,5,1,2,7,3,2,1,10, 4,4,5};
vector<int> v (t,t+15);
int number = count(v.begin(), v.end(), Compare()); cout<< number<<endl;
return 0;
}
Program outputs:
"
Choose the correct option from the given list.
01 / 228