Doubt in a question of quiz on stl

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

#include
#include
#include
using namespace std;
int main()
{
sets;
s.insert(1);
s.insert(5);
s.insert(7);
s.insert(2);
s.insert(12);
s.insert(10);
auto it = s.lower_bound(15);
cout<< *it <<endl;
return 0;
}
here output is given 6 how?

@be10046.19 because elements in the set are 6 and highest val 12 so lower bound of greater than 12 gives size of set .
don’t forget to hit like and mark it as resolved if cleared :smiley:

1 Like