for loop vector code example
Example 1: c++ iterate over vector
for(auto const& value: a) {
/* std::cout << value; ... */
}
Example 2: for loop vector
for (auto i = v.begin(); i != v.end(); i++)
{
std::cout << *i << endl;
}
for(auto const& value: a) {
/* std::cout << value; ... */
}
for (auto i = v.begin(); i != v.end(); i++)
{
std::cout << *i << endl;
}