xxxxxxxxxx
//me
vector<int> v{2,5,3,4,0,1};
sort( v.begin(), v.end() );
//v is now {0,1,2,3,4,5}
xxxxxxxxxx
// C++ program to sort a vector in non-decreasing
// order.
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v{ 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
sort(v.begin(), v.end());
return 0;
}
xxxxxxxxxx
// C++ program to sort a vector in non-decreasing
// order.
#include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v{ 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
sort(v.begin(), v.end());
cout << "Sorted \n";
for (auto x : v)
cout << x << " ";
return 0;
}
xxxxxxxxxx
#include<vector>
#include<algorithm> //**********Have to include THIS...OTHERWISE
sort( vectorName.begin(),vectorName.end() ) ;
xxxxxxxxxx
// C++ program to sort a vector in non-decreasing
// order.
#include <iostream>
#include<algorithm>
using namespace std;
int main()
{
vector<int> v{ 1, 5, 8, 9, 6, 7, 3, 4, 2, 0 };
sort(v.begin(), v.end());
return 0;
}
xxxxxxxxxx
// Initilaize Vector
vector<int> v{10,9,8,7,6,5,4,3,2,1,0};
// Sort Vector
sort(v.begin(), v.end());