-
What is the output of this program?
#include <iostream>
#include <set>
using namespace std;
int main ()
{
multiset<int> MultisetData;
for (int k = 0; k < 6; k++) MultisetData.insert(k);
multiset:: key_compare compare = MultisetData.key_comp();
int highest = *MultisetData.rbegin();
multiset:: iterator Iter = MultisetData.begin();
do
{
cout << ' ' << *Iter;
} while (compare(*Iter++, highest));
return 0;
}
-
- 0 1 2 3 4 5
- 0 1 2 3 4
- 0 1 2 3
- 0 1 2
- 0 1
Correct Option: A
In this program, We used the set template and then we compared the keys and printing the result.