Answers for "how to sort with a function c++"

C++
2

how to sort array in c++

#include <algorithm>

int main(){
  int v[2000];
  std::sort(std::begin(v), std::end(v));
}
Posted by: Guest on October-15-2021
1

sort c++

#include <algorithm>    // std::sort

int myints[] = {32,71,12,45,26,80,53,33};
// using default comparison (operator <):
std::sort (myvector.begin(), myvector.begin()+4);           //(12 32 45 71)26 80 53 33

// fun returns some form of a<b
std::sort (myvector.begin()+4, myvector.end(), myfunction); // 12 32 45 71(26 33 53 80)
Posted by: Guest on April-03-2021

Code answers related to "how to sort with a function c++"

Browse Popular Code Answers by Language