Bonjour,
j'ai un tableau de char 'GPXFILES1' qui contient les caractère suivant: A,C,D,T,W
je veux crée un programme qui m'affiche tout les combinaison possible de 3 caractère sans répétition , dans cette exemple il faut m'affiche
ACD
ACT
ACW
ADT
ADW
ATW
CDT
CDW
CTW
DTW
j'ai essaye avec ce code mais il n'affiche pas un bon résultat :/
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 for (int j = 0, x = 1, y = 1; j < GPXFILES1.length; j++, x++, y++) { for (int i = x; i < GPXFILES1.length; i++) { y++; for (int h = y; h < GPXFILES1.length; h++) { stg1 = GPXFILES1[j] + "" + GPXFILES1[i] + "" + GPXFILES1[h]; System.out.println(stg1); } if (y == GPXFILES1.length) y = 1; }
Partager