How to sort and array with integers in c++/
LETS SAY int arr[5]={1,2,3,4,5};
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
#include <algorithm>
#include <iostream>
int main() {
const int size = 5;
int arr[size] = {1, 3, 2, 5, 4};
std::sort(arr, arr + size);
for (int i = 0; i < size; ++i)
std::cout << arr[i] << ' ';
return 0;
}
|
Last edited on