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

Author:

 list, list, iterator
Download

#include 
#include 
#include

#include 
#include 

using namespace std;

int main( ) {

   list lstStr;

   lstStr.push_back("AB");
   lstStr.push_back("BA");
   lstStr.push_back("AC");
   lstStr.push_back("DXA");
   lstStr.push_back("EE");

   list::iterator p;

   p = find(lstStr.begin( ), lstStr.end( ), "AB");

   cout<<*p<
    

Leave a Reply

Your email address will not be published. Required fields are marked *