how to iterate a vector in c++ code example
Example 1: c++ vector iterator
#include <iostream>
#include <vector>
using namespace std;
vector<int> myvector;
for (vector<int>::iterator it = myvector.begin();
it != myvector.end();
++it)
cout << ' ' << *it;
cout << '\n';
Example 2: c++ iterate over vector
for(auto const& value: a) {
/* std::cout << value; ... */
}