iterate list in c++ code example
Example 1: c++ iterate through vectgor
std::vector<int> vec_of_ints(100);
for (int i = 0; i < vec_of_ints.size(); i++){
std::cout << vec_of_ints.at(i) << " ";
}
std::cout << std::endl;
Example 2: traverse through list c++
for (auto it = mylist.begin(); it != mylist.end(); ++it)
cout << ' ' << *it;
Example 3: how to iterate through array in c++
for(int i=0; i<n; i++)
cout<<array[i]<<" "
cout<<endl;