前言:做校招笔试题需要用到算法,但是函数规则忘了,没敢写……
需要包含头文件#include <algorithm>(建议把这个单词多背几遍)
1.sort,三个参数代表开始地址,结束地址,排序方式,默认升序
sort(first,last,comp);
下面列出静态数组和动态数组使用sort的例子
#include <iostream>
#include <algorithm>
using namespace std;
int arr[5];
int main()
前言:做校招笔试题需要用到算法,但是函数规则忘了,没敢写……
需要包含头文件#include <algorithm>(建议把这个单词多背几遍)
1.sort,三个参数代表开始地址,结束地址,排序方式,默认升序
sort(first,last,comp);
下面列出静态数组和动态数组使用sort的例子
#include <iostream>
#include <algorithm>
using namespace std;
int arr[5];
int main()