Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. /**
  2. * @author pablosky
  3. * Este es el proyecto de laberinto por backtracking
  4. */
  5. public class Main {
  6.  
  7. /**
  8. * @param args
  9. */
  10. public static void main(String[] args) {
  11. // TODO Auto-generated method stub
  12.  
  13. Scanner escaner = new Scanner(System.in);
  14. int tamanio = escaner.nextInt();
  15. escaner.nextLine();
  16. char [][] matrix = new char [tamanio][tamanio];
  17.  
  18. leerMatriz(matrix,tamanio,escaner);
  19.  
  20. }
  21.  
  22. public static void leerMatriz(char [][] matriz, int tam, Scanner scan) {
  23.  
  24. for (int i = 0; i < tam; i++) {
  25.  
  26. String linea = scan.nextLine();
  27. matriz[i] = linea.toCharArray();
  28. }
  29. }
  30.  
  31. public static void printeaMatriz(char [][] matriz, int tam) {
  32.  
  33. for (int i = 0; i < tam; i++) {
  34. for (int j = 0; j < tam; j++) {
  35. System.out.print(matriz[i][j]);
  36. }
  37. System.out.println();
  38. }
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement