fork download
  1. #include <stdio.h>
  2. #define W 8
  3. #define H 6
  4.  
  5. char map[H][W]={
  6. {1,1,1,1,1,1,1,1},
  7. {1,0,0,0,0,0,0,1},
  8. {1,0,1,1,1,0,1,1},
  9. {1,0,0,0,0,1,0,1},
  10. {1,0,0,1,0,0,2,1},
  11. {1,1,1,1,1,1,1,1},
  12. };
  13.  
  14. void print_map(){
  15. int i,j;
  16. for(i=0;i<=5;i++){
  17. for(j=0;j<=7;j++){
  18. switch(map[i][j]){
  19. case 0:
  20. printf(" ");
  21. break;
  22. case 1:
  23. printf("#");
  24. break;
  25. case 2:
  26. printf("G");
  27. break;
  28. }
  29. }
  30. printf("\n");
  31. }
  32. }
  33.  
  34. int main(){
  35. print_map();
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
########
#      #
# ### ##
#    # #
#  #  G#
########