Advertisement
Guest User

Tablero

a guest
May 23rd, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.80 KB | None | 0 0
  1. #include <stdio.h>
  2. #define FILAS 17
  3. #define COLUMNAS 17
  4.  
  5. void inicializar_tablero(int tablero[FILAS][COLUMNAS]);
  6. void imprimir_matriz();
  7.  int main (){
  8.     int tablero[FILAS][COLUMNAS];
  9.      inicializar_tablero(tablero[FILAS][COLUMNAS]);
  10.      
  11.      
  12.  }
  13. void inicializar_tablero(int tablero[FILAS][COLUMNAS]) {
  14.    
  15. int i,j;
  16.  
  17. for(i=0;i<FILAS; i++)
  18. {
  19. for (j=0; j<COLUMNAS; j++){
  20.      
  21.  if (i == 0 || i == FILAS-1){
  22.      tablero [i][j] =1;
  23.      
  24.  }
  25. else if (j == 0 || j == COLUMNAS-1){
  26.     tablero [i][j] =1;
  27. }
  28.    
  29.    
  30.  
  31.  else{
  32.     tablero[i][j]=0;
  33. }
  34. }
  35. void imprimir_matriz(tablero);
  36. }
  37.  
  38. void imprimir_matriz(int tablero[FILAS][COLUMNAS]){
  39. for (i=0;i<=FILAS;i++)
  40.     {  
  41.         for (j=0;j<=COLUMNAS;j++)
  42.         {  
  43.             printf("%d",tablero[i][j]);                
  44.  
  45.         }
  46.  
  47.     }
  48.  printf("\n"); 
  49.    
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement