Stl quiz 1 , q7

please explain how the value 6 is getting printed?

Hello @cs21m014_bac3a0f9c0b24fe7,

lower bound returns an iterator pointing to the element >= the target
if there is no such element it returns an iterator pointing to set.end() and its value is equal to the number of elements in the set

In this case, set has 6 elements and there is no element greater than or equal to 15
So, (*it) = 6

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.