problème d'incrémentation dans les boucles
j'arrive pas à comprendre pourquoi mes boucles n’incrémentes pas d'une maniéré correcte :roll:
voici une partie de mon code:
Code:
String Tab[]= {"(1)" , "(2)" , "(3) " , " (4)" , "(5)" , "null"};
Code:
int R[] = { 0 , 1 , 2 , 5 , 4 };
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| int f1;
int f2;
int f3;
int m1 = 4;
int m2=5;
int m3=6;
int archit=1;
for( int i0 = 0 ; i0 < 4 ; i0++){
for(int j1 = 0 ; j1 < 4 ; j1++){
for(int k2 = 0 ; k2 < 4 ; k2++){
for(int l3 = 0 ; l3 < 4 ; l3++){
for(int m7 = 0 ; m7 < 4 ; m7++){
for(int n8 = 0 ; n8 < 4 ; n8++){
for(int s9 = 0 ; s9 < 4 ; s9++){
for(int p11 = 0 ; p11 < 4 ; p11++){
for(int z12 = 0 ; z12 < 4 ; z12++){
f1 =R[i0]*R[j1]*R[k2]*R[l3]*R[m7]*R[n8]*R[s9]*R[p11]*R[z12];
f2 =R[i0]+R[j1]+R[k2]+R[l3]+R[m7]+R[n8]+R[s9]+R[p11]+R[z12];
f3 =R[i0]-R[j1]-R[k2]-R[l3]-R[m7]-(R[n8]*R[s9]*R[p11]*R[z12]); |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| switch (archit) {
case 1:
if( Tab[0].equals("(1)") && Tab[1].equals("(2)") ) {
if (f1<=m1){
System.out.println("f1 " +f1+" " + i0 + " " + j1 + " " + k2 + " " + l3 + " " + m7 + " " + n8 +" " + s9 + " " + p11 + " " + z12 );
System.out.println("--------------------------------------------------------------------------------------------------------") ;
}
if (f2<=m2){
System.out.println("f2 " +f2+" " + i0 + " " + j1 + " " + k2 + " " + l3 + " " + m7 + " " + n8 +" " + s9 + " " + p11 + " " + z12 );
System.out.println("--------------------------------------------------------------------------------------------------------") ;
}
if (f3<=m3){
System.out.println("f3 " +f3+" " + i0 + " " + j1 + " " + k2 + " " + l3 + " " + m7 + " " + n8 +" " + s9 + " " + p11 + " " + z12 );
System.out.println("--------------------------------------------------------------------------------------------------------") ;
}
break;
}
}}}}}}}}} |
merci
j'ai un problème dans l'héritage
bonjour
j'ai pas compris pourquoi il m'affiche des erreurs .
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
| public class OLL {
String Tab[]= {"(1)" , "(2)" , "(3) " , " (4)" , "(5)" , "(6)" };
double R[] = { 0 , 0.1 , 0.2 , 0.3 , 0.4 , 0.5 , 0.6 , 0.7 , 0.8 , 0.9 };
double f1;
double f2;
double f3;
double f4;
double m=30;
for(int i0 = 0 ; i0 < 10 ; i0++){
for(int i1 = 0 ; i1 < 10 ; i1++){
for(int i2 = 0 ; i2 < 10 ; i2++){
for(int i3 = 0 ; i3 < 10 ; i3++){
for(int i7 = 0 ; i7 < 10 ; i7++){
for(int i8 = 0 ; i8 < 10 ; i8++){
for(int i9 = 0 ; i9 < 10 ; i9++) {
for(int i11 = 0 ; i11 < 10 ; i11++){
for(int i12 = 0 ; i12 < 10 ; i12++){
f1 = R[i0] * R[i1] * R[i2]*R[i3]*R[i7]*R[i8]*R[i9]*R[i10]*R[i11]*R[i12] ;
f2 = R[i0] * R[i1] * R[i2]*R[i3]*R[i7];
f3 = R[i0] + R[i1] + R[i2]*R[i3]*R[i7];
}
}
}
}
}
}
}
}
} |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| public class O1 extends OLL {
int archit= 1;
super();
public void method1 ( ) {
switch(archit){
case 0 :
if(Tab[0].equals("(1)") && Tab[2].equals("(3)") && Tab[3].equals("(4)")) {
if(f1==m){
System.out.println(f1 + " " + R[i0] + " " + R[i3]+ " " + R[i11]);
}}
case 1 :
if(Tab[0].equals("(1)") && Tab[3].equals("(4)") && Tab[4].equals("(5)")){
if(f2==m){
System.out.println(f2 + " " + R[i0] + " " + R[i7]+ " " + R[i12]);
}}
break; |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| public class O2 extends OLL{
int archit= 1;
super();
public void method2 ( ) {
switch(archit){
case 0 :
if(Tab[0].equals("(1)") ) {
if(f3==m){
System.out.println(f3 + " " + R[i0] + " " + R[i8]+ " " + R[i11]);
}}
case 1 :
if(Tab[1].equals("(2)") ){
if(f2==m){
System.out.println(f2 + " " + R[i0] + " " + R[i7]+ " " + R[i11]);
}}
break;
}} |
merci d'avance .