#include <iostream>
#include <vector>
using namespace std;
int main ()
{
//简单地说,vector是一个能够存放任意类型的动态数组,能够增加和压缩数据。
// constructors used in the same order as described above:
vector<int> first; // empty vector of ints
vector<int> second (4,100); // four ints with value 100
vector<int> third (second.begin(),second.end()); // iterating through second
vector<int> fourth (third); // a copy of third
// the iterator constructor can also be used to construct from arrays:
int myints[] = {16,2,77,29};
vector<int> fifth (myints, myints + sizeof(myints) / sizeof(int) );
cout<<"The content of first are:";
for(vector<int>::iterator it = first.begin(); it!=first.end();++it)
cout<<" "<<*it;
cout<<"\n" ;
cout<<"The content of second are:";
for(vector<int>::iterator it = second.begin(); it!=second.end();++it)
cout<<" "<<*it;
cout<<"\n" ;
cout<<"The content of third are:";
for(vector<int>::iterator it = third.begin(); it!=third.end();++it)
cout<<" "<<*it;
cout<<"\n" ;
cout<<"The content of fourth are:";
for(vector<int>::iterator it = fourth.begin(); it!=fourth.end();++it)
cout<<" "<<*it;
cout<<"\n" ;
cout << "The contents of fifth are:";
for (vector<int>::iterator it = fifth.begin(); it != fifth.end(); ++it)
cout << ' ' << *it;
cout <<"\n";
return 0;
}