এই টিউটোরিয়ালে, আমরা C++ STL-এ মাল্টিসেট low_bound() বোঝার জন্য একটি প্রোগ্রাম নিয়ে আলোচনা করব।
নিম্ন_বাউন্ড() ফাংশনটি প্রদত্ত প্যারামিটারের সমতুল্য ধারকটিতে উপাদানটির প্রথম অস্তিত্ব ফিরিয়ে দেয়, অন্যথায় এটি তার থেকে অবিলম্বে বড় উপাদানটি ফেরত দেয়।
উদাহরণ
#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