Bonjour a tous,
je voudrais je voudrais comparer deux matrices char; ayant les meme nombre de colonne et ligne voici ce que j'ai fait mais qui ne marche pas:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public static void compmat(char[][] mat1,char [][]ma t2,String ch )
{
	mat1=new char[ch.length()+1][8];
	mat2=new char[ch.length()+1][8];
	int k=0;
	int nbRow=ch.length()+1;
	for(int i=0; i<nbRow-1; i++) { 
		if(mat1[i][7]!=mat2[i][7]){
			k=i;
	System.out.println("Erreur sur la ligne "+k);
		}
		if(k!=-1)break;
}
if(k==-1)System.out.println("\nIl nya pas d'erreur");
else{ System.out.println("\ncorrection");
		for(int i=0;i<8;i++){
			if(mat1[ch.length()][i]!=mat2[ch.length()][i])
				mat2[k][i]= (mat2[k][i]=='1')? '0' : '1';
}
}
}
Aidez moi S'il vous plait .
Merci.