c++ vector iterator

C++
// EXAMPLE
vector<string> vData;
vData.push_back("zeroth");
vData.push_back("first");
vData.push_back("second");
vData.push_back("third");

std::vector<string>::iterator itData;

for (itData = vData.begin(); itData != vData.end() ; itData++)
{
  auto ElementIndex = itData-vData.begin();
  auto ElementValue = vData[ElementIndex]; // vData[ElementIndex] = *itData
  cout << "[ElementIndex:" << ElementIndex << "][ElementValue:" << ElementValue << "]\n";
}

/* HEADER(S)
#include <vector>
#include <iostream>
using namespace std;
*/#include <iostream>
#include <vector>
using namespace std;

vector<int> myvector;

for (vector<int>::iterator it = myvector.begin();
     it != myvector.end();
     ++it)
   cout << ' ' << *it;
cout << '\n';

Source

Also in C++: