/*********
Author Smile
vector 三种遍历方式
*********/
#include <bits/stdc++.h>
using namespace std;
vector<int> v;
int main()
{
for (int i = 1; i <= 10; ++i)
{
v.push_back(i);
}
for (int i = 0; i < v.size(); ++i)
{
cout << v[i] << endl;
}
for (auto it : v)
cout << it << endl;
for (vector<int>::iterator it = v.begin(); it != v.end(); ++it)
{
cout << *it << endl;
}
return 0;
}
vector 三种遍历方式
最新推荐文章于 2024-02-22 09:04:40 发布