Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1.  
  2.  
  3. public class LASTAR
  4. {
  5. static String tabEnChaine (char[][] tab)
  6. {
  7. String retour;
  8. retour = "";
  9. for (int i=0;i<tab.length;i++)
  10. {
  11. retour = retour + i + " ";
  12. for(int j=0;j<tab[0].length;j++)
  13. {
  14. retour = retour + " ";
  15. retour = retour + tab[i][j] + " ";
  16. }
  17. retour = retour + "\n";
  18. }
  19. return retour;
  20. }
  21.  
  22. public static void main(String[] a)
  23. {
  24. /*----------------------*/
  25. /* Données */
  26. /*----------------------*/
  27.  
  28. char[][] tabCara1;
  29. char[][] tabCara2;
  30. char[][] tabCara3;
  31.  
  32. int [][] tabTest;
  33. /*----------------------*/
  34. /* Instructions */
  35. /*----------------------*/
  36. tabTest = new int[8][8];
  37. // Initialisation des deux tableaux.
  38. tabCara1 = new char[][] { { 'T','C','F','Q','K','F','C','T' },
  39. { 'P','P','P','P','P','P','P','P' },
  40. { ' ',' ',' ',' ',' ',' ',' ',' ' },
  41. { ' ',' ',' ',' ',' ',' ',' ',' ' },
  42. { ' ',' ',' ',' ',' ',' ',' ',' ' },
  43. { ' ',' ',' ',' ',' ',' ',' ',' ' },
  44. { 'p','p','p','p','p','p','p','p' },
  45. { 't','c','f','q','k','f','c','t' } };
  46.  
  47. tabCara2 = new char[][] { { 'A', 'B', 'C', 'D' },
  48. { 'E', 'F', 'G', 'H' } };
  49.  
  50.  
  51. tabCara3 = new char[][] { { 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M' },
  52. { 'M', ' ', ' ', 'M', ' ', ' ', ' ', 'M', ' ' },
  53. { 'M', ' ', 'M', 'M', 'M', 'M', ' ', ' ', ' ' },
  54. { 'M', ' ', 'M', 'M', 'M', 'M', 'M', 'M', ' ' },
  55. { 'M', ' ', ' ', ' ', 'M', 'M', ' ', ' ', ' ' },
  56. { 'M', 'M', 'M', ' ', 'M', 'M', ' ', 'M', 'M' },
  57. { 'M', ' ', 'M', ' ', 'M', 'M', ' ', 'M', 'M' },
  58. { 'M', 'M', ' ', ' ', 'M', 'M', ' ', ' ', ' ' },
  59. { 'M', ' ', ' ', 'M', 'M', 'M', ' ', 'M', ' ' },
  60. { 'M', ' ', 'M', 'M', 'M', 'M', ' ', 'M', ' ' },
  61. { 'M', ' ', ' ', ' ', ' ', 'M', ' ', 'M', ' ' },
  62. { 'M', ' ', 'M', 'M', ' ', 'M', ' ', 'M', ' ' },
  63. { 'M', ' ', ' ', ' ', ' ', ' ', ' ', 'M', ' ' },
  64. { 'M', 'M', 'M', 'M', 'M', 'M', 'M', 'M', ' ' } };
  65.  
  66. // ETAPE 1 Affichage de tabCara1 à l'aide de tabEnChaine de VisuGrille
  67. System.out.println(tabEnChaine(tabCara1));
  68. //System.out.println();
  69.  
  70.  
  71.  
  72. // ETAPE 2 Affichage de tabCara2 à l'aide de tabEnChaine de VisuGrille
  73. //System.out.println(tabEnChaine(tabCara2));
  74. //System.out.println();
  75.  
  76.  
  77. // ETAPE 3 Affichage de tabCara3 à l'aide de tabEnChaine de VisuGrille
  78. //System.out.println(tabEnChaine(tabCara3));
  79. //System.out.println();
  80.  
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement