I am new to the C++ language. I have been starting to use vectors, and have noticed that in all of the code I see to iterate though a vector via indices, the first parameter
The correct way of iterating the loop and printing its values are as follows:
#include
//declare the vector of type int
vector v;
//insert the 5 element in the vector
for ( unsigned int i = 0; i < 5; i++){
v.push_back(i);
}
//print those element
for (auto it = 0; it < v.end(); i++){
std::cout << *it << std::endl;
}