fork download
  1. #include <stdio.h>//第2講演習問3
  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. void maze0(int x, int y, int depth){
  14. int i;
  15. for(i=1;i<=depth*2;i++){
  16. printf(" ");
  17. }
  18. if(map[y][x]==0)printf("(%d,%d)\n",x,y);
  19. else if(map[y][x]==1)printf("(%d,%d)X\n",x,y);
  20. else if(map[y][x]==2)printf("(%d,%d)OK\n",x,y);
  21. }
  22. int main(void) {
  23. int x,y,depth;
  24. x=2;
  25. y=2;
  26. depth=3;
  27. maze0(x,y,depth);
  28. return 0;
  29. }
Success #stdin #stdout 0.01s 5332KB
stdin
Standard input is empty
stdout
      (2,2)X