-
What is the output of this program?
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int k, int L)
{
return (k==L);
}
int main ()
{
int Array[] = {101, 202, 202, 202, 303, 303, 202, 202, 101};
vector<int> num (Array, Array + 9);
vector<int> :: iterator Iter;
Iter = unique (num.begin(), num.end());
num.resize( distance(num.begin(), Iter) );
unique (num.begin(), num.end(), myfunction);
for (Iter = num.begin(); Iter != num.end(); ++Iter)
cout << ' ' << *Iter;
return 0;
}
-
- 101 202 303 202 101
- 101 202 303
- 101 202 303 202
- 101 202
- 101
Correct Option: A
In this program, We are printing only the unique values by comparing every value.