vector数组的翻转与排序

#include <algorithm>
reverse(vec.begin(), vec.end())//将元素翻转,即逆序排列!
 
#include <algorithm>
sort(vec.begin(), vec.end()); //采用的是从小到大的排序
//如果想从大到小排序,可以采用上面反转函数,也可以采用下面方法:
bool Comp(const int& a, const int& b) {
    return a > b;
}
sort(vec.begin(), vec.end(), Comp);
原文地址:https://www.cnblogs.com/Clark-Shao/p/14902188.html