博客
关于我
在sort()函数中使用greater()和less()
阅读量:134 次
发布时间:2019-02-27

本文共 723 字,大约阅读时间需要 2 分钟。

?C++???????????????????????std::sort???????????????????????????????greater?less?????????????????????

????

????????????????

#include 
#include
#include
using namespace std;

????

??????????

int a[] = {3, 1, 4, 2, 5};int len = sizeof(a) / sizeof(int);

??????????????????????????greater???????????????

sort(a, a + len, greater
());

??????????????greater???less?

sort(a, a + len, less
());

????

??????????????????????

for (int i = 0; i < len; ++i) {    cout << a[i] << " ";}cout << endl;

????

  • greater<int>???????????????????????
  • less<int>()???????????????????????
  • sort(a, a + len, [???])????????a + len???????????
  • ????????????????????????????????????????????????????????

    转载地址:http://xsjb.baihongyu.com/

    你可能感兴趣的文章
    Tomcat学习总结(19)—— 为什么首选Tomcat作为JavaWeb应用服务器?
    查看>>
    oracle的内置函数
    查看>>
    Oracle的存储结构
    查看>>
    Oracle的聚合函数group by结合CUBE和ROLLUP的使用
    查看>>
    Oracle监听配置、数据库实例配置等
    查看>>
    Oracle知识补充
    查看>>
    Oracle笔记(十三) 视图、同义词、索引
    查看>>
    Oracle笔记(十) 约束
    查看>>
    【BOOST C++字串专题07】 Boost.Format
    查看>>
    oracle系列(六)OEM与常见故障处理
    查看>>
    Oracle系列:安装Oracle RAC数据库(二)
    查看>>
    oracle系统 介绍,ORACLE数据库管理系统介绍
    查看>>
    Thymeleaf模板引擎的编写
    查看>>
    oracle获取数据库表、字段、注释、约束等
    查看>>
    ThreeJS入门(163):THREE.TextureLoader 知识详解,示例代码
    查看>>
    Oracle表的操作
    查看>>
    Oracle表空间、用户的创建及导入导出
    查看>>
    oracle表空间查询维护命令大全之三(暂时表空间)史上最全
    查看>>
    oracle表访问方式
    查看>>
    Oracle触发器
    查看>>