vector <int> a;
for (int i = 0 ; i < 10; i++)
{
a.push_back(i);
}
# 遍历方法1
for (int i = 0; i < a.size(); i++)
cout << a[i] << " ";
# 遍历方法2
vector<int>::iterator it;
for(it=a.begin(); it != a.begin(); it++)
{
cout << *it << " ";
}
# 遍历方法3
for (auto it = a.beigin(); it != a.end(); it++)
{
cout << *it << endl;
}
# 遍历方法4
for (auto x : a)
{
cout << x << " ";
}