+ 2

How work iterator in c++? How work method Next?

27th Nov 2017, 8:11 PM
Nastasia
Nastasia - avatar
8 Answers
27th Nov 2017, 8:20 PM
Nastasia
Nastasia - avatar
+ 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++) ...
27th Nov 2017, 8:27 PM
Elegis Sossou
Elegis Sossou - avatar
+ 3
27th Nov 2017, 8:28 PM
Elegis Sossou
Elegis Sossou - avatar
+ 3
You're welcome
27th Nov 2017, 8:33 PM
Elegis Sossou
Elegis Sossou - avatar
+ 3
Okey, good luck
27th Nov 2017, 8:41 PM
Elegis Sossou
Elegis Sossou - avatar
+ 2
Need help on your code?
27th Nov 2017, 8:36 PM
Elegis Sossou
Elegis Sossou - avatar
0
thank you so much
27th Nov 2017, 8:31 PM
Nastasia
Nastasia - avatar
0
whith this code no, but thank you for help:)
27th Nov 2017, 8:38 PM
Nastasia
Nastasia - avatar