You can enumerate all characters in a string:

for (auto elem : str)
// elem is your character

// Or for pre-C++11
for (std::string::iterator it = str.begin(); it != str.end(); ++it)
// *it...