mset3.cpp

mset3.cpp

#include ‹iostream.h›

#include ‹stl.h›

int array[] = {3, 6, 1, 2, 3, 2, 6, 7, 9};

int main() {

 multiset‹int, less‹int› › s(array, array + 9);

 multiset‹int, less‹int› ›::iterator i;

 // Return location of first element that is not less than 3

 i = s.lower_bound(3);

 cout ‹‹ "lower bound = " ‹‹ *i ‹‹ endl;

 // Return location of first element that is greater than 3

 i = s.upper_bound(3);

 cout ‹‹ "upper bound = " ‹‹ *i ‹‹ endl;

 return 0;

}