Finding Values in a Sequence with find algorithm - C++ STL Algorithm

C++ examples for STL Algorithm:find

Description

Finding Values in a Sequence with find algorithm

Demo Code

#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;
}

Related Tutorials