Since std::distance
is only constant time for random-access iterators, I would probably prefer explicit iterator arithmetic.
Also, since we're writing C++ code here, I do believe a more C++ idiomatic solution is preferable over a C-style approach.
string str{"Test string"};
auto begin = str.begin();
for (auto it = str.begin(), end = str.end(); it != end; ++it)
{
cout << it - begin << *it;
}