sort用法

#include <algorithm>
 
template< class RandomIt >
void sort( RandomIt first, RandomIt last );
 
template< class RandomIt, class Compare >
void sort( RandomIt first, RandomIt last, Compare comp );

默认的顺序为升序。

bool cmp1(int a,int b)//int为数组数据类型
{
    return a>b;//降序排列
    //return a<b;//默认的升序排列
}


猜你喜欢

转载自blog.csdn.net/princejin_dybala/article/details/79133314
今日推荐