Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

C++: Rechercher un élément dans une liste

 list, list, iterator
{filelink=15466}

#include <iostream>
#include <string>
#include
<list>
#include <algorithm>
#include <functional>
 
using namespace std;
 
int main( ) {
 
   list<string> lstStr;
 
   lstStr.push_back("AB");
   lstStr.push_back("BA");
   lstStr.push_back("AC");
   lstStr.push_back("DXA");
   lstStr.push_back("EE");
 
   list<string>::iterator p;
 
   p = find(lstStr.begin( ), lstStr.end( ), "AB");
 
   cout<<*p<<endl;
}

No comments yet.

Leave a Comment