Create an iterator to a string and Use it to cycle through the characters of a string
#include <iostream> #include <string> #include <cctype> #include <algorithm> #include <vector> using namespace std; int main() { string strA("This is a test."); string::iterator itr; for(itr = strA.begin(); itr != strA.end(); ++itr) cout << *itr; return 0; }