J'essaye de trier une matrice par colonne.
Après recherche sans trouver de fonction spécifique,
J'essaye :
for (i=0;i<tableau_contact;i++) {
// Copier la seconde colonne avant la première
reserve = tableau_contact[i][0];
tableau_contact[i][0] = tableau_contact[i][1];
tableau_contact[i][1] = reserve;
}
tableau_contact.sort();
for (i=0;i<tableau_contact;i++) {
// Copier la seconde colonne avant la première
reserve = tableau_contact[i][0];
tableau_contact[i][0] = tableau_contact[i][1];
tableau_contact[i][1] = reserve;
}
Sans succes :(
Est-ce que "sort" fonctionne sur des sous-tableaux ?
Comment feriez-vous ?