Set Upper_bound()

#include<iostream>
#include<set>
#include<algorithm>
using namespace std;
int main()
{
    set<int> s = {1,2,3,4,5,6,7,8,9,10};
    auto t = s.upper_bound(4);

    if(t == s.end())
        cout << "Not Found." << endl;
    else
        cout << *t << endl;

    return 0;
}

Comments