排序
1 #include <algorithm> 2 3 vector<int> vc; 4 sort(vc.begin(),vc.end(),less<int>());//默认升序排序 5 sort(vc.begin(),vc.end(),greater<int>());//降序排序 6 7 or 8 vector<int> vc; 9 bool cmp(const int& a, const int& b){ 10 return a<b;//升序 11 } 12 sort(vc.begin(),vc.end(),cmp);//升序
原文:https://www.cnblogs.com/pacino12134/p/10993801.html