lambda表达式

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main()
{
    vector<int> vec{ 1,2,3,4,3,2,6,4,7,8 };
    sort(vec.begin(), vec.end(), [](int a, int b)->bool {
        return a > b;
    });
    for (auto num : vec) {
        cout << num << " ";
    }
    cout << endl;
    system("PAUSE");
    return 0;
}
全部评论

相关推荐

星辰再现:裁员给校招生腾地方
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务