How to check if a vector is sorted in C++

1 Answer

0 votes
#include <iostream>     
#include <algorithm>    
#include <vector>       

int main () {
  std::vector<int> vec {0, 6, 7, 8, 9, 18};

  std::cout << is_sorted(vec.begin(), vec.end());
 
}




/*
run:

1

*/

 



answered Nov 21, 2022 by avibootz
...