bizzare chez moi rien ne s'affiche
alors j'ai in serrer e s'affiche rien ..je fais quoi comme erreur?
j'ai mis a deux endroit aucun affiche?
au deuxieme si e dis afficher i ..la me donne un affichage
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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
| package file;
import java.io.*;
import java.io.File;
import java.io.FileReader;
public class files {
int[] tableau;
int[] tableau2 = new int[1000];
int[] tableau3 = new int[1000];
int[] tableau4 = new int[1000];
int n = 0;
int c = 1;
/**
* Constructeur
*/
public files() {
try (BufferedReader b = new BufferedReader(new FileReader(new File("D:/taxe.txt")))) {
String line;
// Lecture du fichier ligne par ligne. Cette boucle se termine
// quand la méthode retourne la valeur null.
while ((line = b.readLine()) != null) {
// STOCK LA LIGNE DANS UN BUFFER
// String tmp = b.readLine();
// COUPE LA LIGNE SUIVANT LES ESPACES
String[] args = line.split("\\s+");
// ALLOUE NOTRE TABLEAU DE N ELEMENTS
tableau = new int[args.length];
// COPIE CHAMP A CHAMP + AFFICHAGE
for (int i = 1; i < tableau.length; i++) {
tableau[i] = Integer.parseInt(args[i]);
System.out.print(tableau[i]);
System.out.print(" ");
c = c + 1;
if (c == 6) {
c = 1;
System.out.println(" ");
}
n++;
}
{
int indiceTableau = 0;
int[] tableauIndiceCherche = new int[tableau.length];
int[] tableauIndiceTrouve = new int[tableau.length];
for (int i = 0; i < tableau.length - 1; i++) {
int indiceTrouve = recherche(tableau[i], tableau, i + 1);
if (indiceTrouve >= 0) {
// par exemple
tableauIndiceCherche[indiceTableau] = i;
tableauIndiceTrouve[indiceTableau] = indiceTrouve;
System.out.println(i);
System.out.println(" ");
indiceTableau++; // on passe à la case suivante
}
}
}
}
}
catch (
IOException e)
{
// System.out.println("Erreur, le fichier n'existe pas ou est mal
// formaté");
e.printStackTrace();
}
}
public static int recherche(int maValeur, int[] tab, int depart) {
int monIndice = -1;
for (int i = depart; monIndice == -1 && i < tab.length; i++) {
if (maValeur == tab[i]) {
System.out.print(tab[i]);
System.out.println(" ");
monIndice = i;
}
}
return monIndice;
}
/**
* MAIN
*/
public static void main(String[] args) {
// On lance notre lire fichier
new files();
}
} |