इस ट्यूटोरियल में, हम C++ STL में मल्टीसेट लोअर_बाउंड () को समझने के लिए एक प्रोग्राम पर चर्चा करेंगे।
फ़ंक्शन निचला_बाउंड () कंटेनर में दिए गए पैरामीटर के बराबर तत्व का पहला अस्तित्व देता है, अन्यथा यह उस तत्व से तुरंत बड़ा तत्व लौटाता है।
उदाहरण
#include <bits/stdc++.h>
using namespace std;
int main(){
multiset<int> s;
s.insert(1);
s.insert(2);
s.insert(2);
s.insert(1);
s.insert(4);
cout << "The multiset elements are: ";
for (auto it = s.begin(); it != s.end(); it++)
cout << *it << " ";
auto it = s.lower_bound(2);
cout << "\nThe lower bound of key 2 is ";
cout << (*it) << endl;
it = s.lower_bound(3);
cout << "The lower bound of key 3 is ";
cout << (*it) << endl;
it = s.lower_bound(7);
cout << "The lower bound of key 7 is ";
cout << (*it) << endl;
return 0;
} आउटपुट
The multiset elements are: 1 1 2 2 4 The lower bound of key 2 is 2 The lower bound of key 3 is 4 The lower bound of key 7 is 5