example4_use_with_caution.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include <iostream>
#include <vector>
#include <algorithm>

int main() {
    using namespace std;

    vector<int> numbers = {5, 2, 8, 1, 9};
    sort(numbers.begin(), numbers.end());

    for (const auto& num : numbers) {
        cout << num << " ";
    }
    cout << endl;

    return 0;
}
Back to using