GLProgramming.com

home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-


New Paste :: Recent Pastes:: No Line Numbers


little search by glDaher
1
 
#include <iostream>
#include <vector>
#include <string>

///////////////////////////////////////////////////////
// main()
void main()
    {
    std::vector<std::string> vec;
    vec.push_back( "sup" );
    vec.push_back( "wtf" );
    vec.push_back( "sup" );
    vec.push_back( "wtf" );
    vec.push_back( "sup" );
    vec.push_back( "wtf" );
    vec.push_back( "sup" );
    vec.push_back( "sup" );

    std::vector<std::string>::iterator iter;

    iter = vec.begin();
    while( iter != vec.end() )
        {

        if( *iter == std::string( "sup" ) )
            std::cout << "found\n"; // use iterator
        else
            std::cout << "not found\n";

        iter++;
        }
    }