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

Author:

 iterator
Download


#include 
#include 
#include 
#include 
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(cout," "));
    cout << endl;

	return 0;
}

Leave a Reply

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