STL
vector 变长数组 倍增的思想 (系统为某一程序分配空间时,所需时间与空间大小无关,与申请请求次数有关)
size() empty() clear() 清空 front()/back() push_back()/pop_back() begin()/end() [] 支持比较运算
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
vector<int> a;
for(int i = 0; i <10; i++) a.push_back(i);
// vector 三种遍历方式
for(int i =0 ; i < 10 ; i++) cout << a[i] << " ";
cout << endl;
for(vector<int>::iterator i = a.begin(); i != a.end(); i ++ ) cout << *i << " ";
cout << endl;
for(auto x : a) cout << x << " ";
cout << endl;
return 0;
}