+ 2
How work iterator in c++? How work method Next?
8 Réponses
+ 4
Iterator is like a pointer on a container (vector, stack, queue, etc)
You declare it like this : vector<int>::iterator it1 or stack<double>::iterator it2 representing iterator on vector containing int and iterator on stack containing double respectively.
All containers have 'begin' and 'end' iterator. You can so use this to browse into a defined container.
#include <vector>
...
...
vector<int> myVector;
vector.push_back(5);
vector.push_back(3);
vector.push_back(2);
...
...
for(vector<int>::iterator it=myVector.begin; it!=myVector.end; i++)
...
+ 3
check this for more details
http://www.cplusplus.com/reference/iterator/
+ 3
You're welcome
+ 3
Okey, good luck
+ 2
Need help on your code?
0
thank you so much
0
whith this code no, but thank you for help:)