TP_Cpp/TP2/exercice6.cpp

34 satır
No EOL
645 B
C++

#include <iostream>
#include <string>
#include <list>
#include <algorithm>
using namespace std;
int main(/*int argc, char const *argv[]*/)
{
list<string> liste;
liste.push_back("Il");
liste.push_back("fait");
liste.push_back("beau");
cout << "Avant : " << endl << endl;
for(list<string>::iterator it=liste.begin(); it!=liste.end();it++){
cout << *it << endl;
}
list<string>::iterator searcher=find(liste.begin(),liste.end(),"beau");
liste.insert(searcher,"très");
cout << endl << "Après : " << endl << endl;
for(list<string>::iterator it2=liste.begin(); it2!=liste.end();it2++){
cout << *it2 << endl;
}
return 0;
}