#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
void Print(int v)
{
cout << v << endl;
}
bool Greater(int v1 ,int v2)
{
return v1 > v2;
}
void test01()
{
vector<int> v;
v.push_back(10);
v.push_back(30);
v.push_back(20);
v.push_back(60);
v.push_back(50);
sort(v.begin(), v.end(), greater<int>());
//sort(v.begin(), v.end(), Greater);
//sort(v.begin(), v.end());
for_each(v.begin(), v.end(), Print);
cout << endl;
}
int main()
{
test01();
return 0;
}
C++中对容器进行排序的三种方式
最新推荐文章于 2023-05-30 20:23:55 发布