comptage pour la combinaison 1

et stockage des id des combinaisons de 2 chiffres
This commit is contained in:
NicolasFabregas 2021-01-31 15:13:49 +01:00
parent 47225dd23d
commit 5c79e3f681
2 changed files with 9 additions and 3 deletions

View file

@ -107,14 +107,15 @@ public class Choix {
} }
public void afficherCombinaisons2(int chiffre1){ public void afficherCombinaisons2(int chiffre1){
int j=0, k=0, l=0; int j=0, k=0, l=0, cpt=0;
for(int i=1;i<50;i++) { for(int i=1;i<50;i++) {
if (i != chiffre1) { if (i != chiffre1) {
while (numId[chiffre1][j] != 0) { while (numId[chiffre1][j] != 0) {
while (numId[i][k] != 0) { while (numId[i][k] != 0) {
System.out.println(numId[i][k] +"=="+ numId[chiffre1][j]);
if (numId[i][k] == numId[chiffre1][j]) { if (numId[i][k] == numId[chiffre1][j]) {
combi1Cpt[i]++; combi1Cpt[i]++;
combi1Id[i][0]=numId[i][k]; combi1Id[i][cpt++]=numId[i][k];
} }
k++; k++;
} }
@ -123,8 +124,12 @@ public class Choix {
} }
j = 0; j = 0;
} }
cpt=0;
} }
for (int i=1; i<50;i++) { for (int i=1; i<50;i++) {
/*for (int p=1; p<50;p++) {
System.out.print(combi1Id[i][p]+", ");
}*/
System.out.println(i+": "+combi1Cpt[i]); System.out.println(i+": "+combi1Cpt[i]);
while(combi1Id[i][l]!=0){ while(combi1Id[i][l]!=0){
System.out.print(combi1Id[i][l]+", "); System.out.print(combi1Id[i][l]+", ");

View file

@ -20,5 +20,6 @@ public class test{
Choix c=new Choix(); Choix c=new Choix();
c.afficherChiffre1(); c.afficherChiffre1();
//c.afficherNumBonus(); //c.afficherNumBonus();
c.afficherCombinaisons2(4);
} }
} }