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}; auto it = is_sorted_until(numbers.begin(), numbers.end()); int position = it - numbers.begin(); cout << "The first " << position << " items are in ascending order."; return 0; }
The first 2 items are in ascending order.