C++ examples for STL Algorithm:find
Finding Values in a Sequence with find algorithm
#include <algorithm> #include <iostream> #include <string> using namespace std; int main(int argc, char* argv[]) { string myString{ "Bruce Sutherland" }; auto found = find(myString.begin(), myString.end(), 'e'); while (found != myString.end()) {/*from w ww . ja va2 s . c o m*/ cout << "Found: " << *found << endl; found = find(found+1, myString.end(), 'e'); } return 0; }