-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int k)
{
return ((k % 2) == 1);
}
int main ()
{
vector<int> num;
num.push_back(110);
num.push_back(45);
num.push_back(85);
num.push_back(101);
vector<int> :: iterator Iter = find_if (num.begin(),
num.end(), IsOdd);
cout << *Iter << '\n';
return 0;
}
-
- 110
- 85
- 101
- 45
- None of these
Correct Option: D
In this program, We used find_if method and returned the first odd value in the vector.