#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
cout << "********************一维向量*************************" << endl;
vector<int> a;
for (int i = 0; i < 6; i++)
{
a.push_back(i);
}
cout << "a[4]:" << a[4] << endl;
cout << "*********************************************" << endl;
for (int i = 0; i < 6; i++)
{
cout << i <<":" << a[i] << endl;
}
a.push_back(1);
a.push_back(2);
a.push_back(3);
cout << "去重前 " <<a.size() << endl;
cout << "*********************************************" << endl;
sort(a.begin(), a.end());
a.erase(unique(a.begin(), a.end()), a.end());
cout << "去重前" << a.size() << endl;
//a.size() //获取向量中的元素个数
//a.empty() //判断向量是否为空
//a.clear() //清空向量中的元素
//a = b; //将b向量复制到a向量中
system("pause");
return 0;
}