Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

C/C++: Trier tous les éléments d’un tableau

 iterator
{filelink=15123}

 
#include <iostream>
#include <algorithm>
#include <functional>
#include <iterator>
using namespace std;
 
int main()
{
    int tab[] = { 0, -6, 2, -4, 1, 13 };
 
    // Trier le tableau
    sort (tab, tab+6);
 
    // Afficher le contenu trié
    copy (tab, tab+6,
          ostream_iterator<int>(cout," "));
    cout << endl;
 
	return 0;
}

No comments yet.

Leave a Comment