-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool IsOdd (int k)
{
return (k % 3) == 1;
}
int main ()
{
vector<int> num;
for (int k = 1; k < 15; ++k) num.push_back(k);
vector<int> :: iterator bound;
bound = partition (num.begin(), num.end(), IsOdd);
for (vector<int> :: iterator Iter = num.begin(); Iter != bound; ++Iter)
cout << ' ' << *Iter;
return 0;
}
-
- 1
- 1 13
- 1 13 10
- 1 13 10 4
- 1 13 10 4 7
Correct Option: E
In this program, We are finding the odd values in the sequence.