Hugo
0
Q:

std vector sort

// C++ program to sort a vector in non-decreasing 
// order. 
#include <bits/stdc++.h> // Vector 
#include <algorithm>  // Sort
using namespace std; 
  
int main() 
{ 
// Initalizing the vector v with these values
    vector<int> v{ 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 }; 
// Vector is sorted in ascending order   
    sort(v.begin(), v.end()); 
  
    return 0; 
} 
11
 int arr[]= {2,3,5,6,1,2,3,6,10,100,200,0,-10};
    int n = sizeof(arr)/sizeof(int);  
    sort(arr,arr+n);

    for(int i: arr)
    {
        cout << i << " ";
    }
3
std::sort(myvector.begin(), myvector.end());
0

New to Communities?

Join the community