Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Trier un tableau de string à l’aide de l’algorithme ‘sort()’

 list, list, iterator
{filelink=15219}

#include <iostream>
#include <algorithm>
#include <functional>
#include <iterator>
#include <string>
using namespace std;
 
int main()
{
	string listStr[]={"Janvier", "Février", "Mars", "Avril", "Mai", "Juin"};
 
	sort (listStr,listStr+6);
 
    copy (listStr, listStr+6,
          ostream_iterator<string>(cout," "));
    cout << endl;
}

No comments yet.

Leave a Comment