fork download
  1. #include <stdio.h>//第2講演習問1
  2. #define W 8
  3. #define H 6
  4.  
  5.  
  6. int main(void) {
  7. char map[H][W]={
  8. {1,1,1,1,1,1,1,1},
  9. {1,0,0,0,0,0,0,1},
  10. {1,0,1,1,1,0,1,1},
  11. {1,0,0,0,0,1,0,1},
  12. {1,0,0,1,0,0,2,1},
  13. {1,1,1,1,1,1,1,1},
  14. };
  15. int y,x;
  16. for(y=0;y<H;y++){
  17. for(x=0;x<W;x++){
  18. if(map[y][x]==0)printf(" ");
  19. else if(map[y][x]==1)printf("#");
  20. else if(map[y][x]==2)printf("G");
  21. }
  22. printf("\n");
  23. }
  24. return 0;
  25. }
  26.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
########
#      #
# ### ##
#    # #
#  #  G#
########