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
|
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
public class Test {
public static void main(String[] args) throws FileNotFoundException, IOException {
BufferedReader br = new BufferedReader(new FileReader("mapTest.map"));
String temp[] = new String[11];
char tab[][] = new char[11][10];
int i = 0;
String ligne;
String nomMap = br.readLine();
int nombreLignes = Integer.parseInt(br.readLine());
int nombreColonnes = Integer.parseInt(br.readLine());
do
{
ligne = br.readLine();
if (ligne != null)
{
temp[i] = ligne;
i++;
}
}
while (ligne != null);
br.close();
for (int j = 0 ; j < nombreLignes ; j++)
{
for (int h = 0 ; h < nombreColonnes ; h++)
{
tab[j][h] = temp[j].charAt(h);
}
}
System.out.println("Nom de la map : " + nomMap);
System.out.println("Taile de la map : " + nombreLignes + "x" + nombreColonnes);
System.out.println("Detail de la map : \n");
for (int j = 0 ; j < nombreLignes ; j++)
{
for (int h = 0 ; h < nombreColonnes ; h++)
{
System.out.print(tab[j][h]);
}
System.out.println("");
}
}
} |
Partager