本文根据本人经验整理太久没用就会忘的知识点或函数用法。 顺序是我在编程中遇到的顺序,有点乱,见谅。
【会根据遇到的问题不定时更新】
目录
6. 函数中的char数组最大能开4*518028,int最大能开到518028。
1. #define LL long long int
2. sort 函数
参考链接:C++ sort()排序详解
3.Vector
- 参考链接:C++_vector操作 ; “vector” 中的 “iterator”
- vector有个sort函数用法:
sort(vec.begin(),vec.end())
- C++ Primer Plus 4.10节中写了vector可以当成是数组的替代品之一,vector的功能比数组强大,但是代价大。如果长度固定,还是首选数组的。
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<int> v(8);
v[0] = 4;
v[1] = 5;
v[2] = 1;
v[3] = 6;
v[4] = 2;
v[5] = 7;
v[6] = 3;
v[7] = 8;
sor