使用该函数要加上一个头文件algorithm才能使用
该函数的功能:对给定范围内的序列进行升序排序(默认升序排列)。sort(begin,end,cmp),cmp参数默认升序。
vector容器函数进行排序时:sort(nums.begin(),nums.end());
数组排序时一般为,示例:
int a[7] = {1,11,9,6,8,3,2};
sort(a,a+7);
使用该函数要加上一个头文件algorithm才能使用
该函数的功能:对给定范围内的序列进行升序排序(默认升序排列)。sort(begin,end,cmp),cmp参数默认升序。
vector容器函数进行排序时:sort(nums.begin(),nums.end());
数组排序时一般为,示例:
int a[7] = {1,11,9,6,8,3,2};
sort(a,a+7);