set stl Question 8

Last Updated :
Discuss
Comments

What will be the output of the following C++ program?

#include <bits/stdc++.h>
using namespace std;
int main()
{
multiset<int> s;

s.insert(10);
s.insert(15);
s.insert(13);

for (auto it = s.begin(); it != s.end(); it++)
cout << *it << " ";
cout<<endl;
// when 10 is present
auto it = s.upper_bound(10);
cout << (*it) << endl;
return 0;
}

c

10 13 15
13

10 15 13
13

13 15 10
15

15 13 10
10

Share your thoughts in the comments