C++: Retourner une sous-chaîne avec l’algorithme ‘find()’

Author:

 iterator
Download


#include 
#include 
#include 
#include 
using namespace std;

int main()
{
  string str("Bienvenu sur cpp.mesexemples.com");
  ostream_iterator out(cout, " ");

  vector::iterator substring = find(str.begin(), str.end(), 'c');
  cout << "La sous-chaîne à partir de cpp: ";
  copy(substring, str.end(), out); cout << endl;

  return 0;
}

/*
La sous-chaîne à partir de cpp: c p p . m e s e x e m p l e s . c o m

*/        

Leave a Reply

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