執行 ❯
建立您
自己的
網站
×
更改方向
更改主題,深色/淺色
前往 Spaces
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { vector<int> 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; }
前2個專案是按升序排列的。