Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
#include
#include
#include
using namespace std; int main() { vector
numbers = {1, 7, 3, 5, 9, 2}; sort(numbers.begin(), numbers.end()); auto it = upper_bound(numbers.begin(), numbers.end(), 7); if (it != numbers.end()) { cout << *it << " is the first value greater than 7"; } else { cout << "No elements found above the upper bound"; } return 0; }
9 is the first value greater than 7