primer_c++_迭代器
#include <iostream> #include <vector> using namespace std; int main() { vector<int> v1{ 1, 2,3,4,5,6,7,8,9,10 }; for (auto i = v1.begin(); i != v1.end(); i++) { (*i) *= 2; cout << *i<<endl; } return 0; }
#include <iostream> #include <vector> using namespace std; int main() { vector<int> v1{ 1, 2,3,4,5,6,7,8,9,10 }; for (auto i = v1.begin(); i != v1.end(); i++) { (*i) *= 2; cout << *i<<endl; } return 0; }