Good afternoon, I need to compare two .txt
files and check that each character is the same as the other file and store which characters are the same ... Type a template
A prova.txt
file has the following content:
1;VVFF
2;VFVF
3;FFFV
The template has the following content:
1;VVFF
2;FFVV
3;FFFF
Make a comparison and add up how many answers matched
int pontuacao = 0;
Scanner sc = new Scanner(System.in);
String gabaritoVetor[] = new String[3];
String notaVetor[] = new String[3];
for (int c = 0; c < gabaritoVetor.length; c++) {
gabaritoVetor[c] = leitura; //recebe os dados do prova.txt
}
for (int i = 0; i < notaVetor.length; i++) {
notaVetor[i] = leitura2; //recebe os dados do gabarito.txt
if (notaVetor[i].equals(gabaritoVetor[i])) {
pontuacao++;
}
}
System.out.println("\nPontuação: " + pontuacao);
I tested with the same files worked, when I modified gave Pontuação = 0
If the files are the same it shows Pontuação = 3
Any ideas?