#include <iostream>

#include <vector>
#include <algorithm>

using namespace std;


int main() {
    vector<int> vectorValue {5, 3, 4, 1, 2};

    std::sort(vectorValue.begin(), vectorValue.end());
    for (auto value: vectorValue)
        std::cout << value << std::endl;


    std::sort(vectorValue.rbegin(), vectorValue.rend());
    for (auto value: vectorValue)
        std::cout << value << std::endl;

    return 0;
}

Logo

加入社区!打开量化的大门,首批课程上线啦!

更多推荐