Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main()
  5. {
  6. int x=0,y=0, aux=0, a = 20, b = 30;
  7. char z=0, h = 0;
  8.  
  9. char matriz[8][8];
  10. FILE *ip;
  11. ip = fopen("joao.txt", "r");
  12. while(1)
  13. {
  14. aux = fscanf(ip,"%d %d %c", &x,&y,&z);
  15. printf("%d\n",aux);
  16. if(aux != 3)
  17. {
  18. break;
  19. }
  20.  
  21. if((x<=7) &&(x>=0))
  22. {
  23. a = x + 1;
  24. }
  25. if((y<=7)&&(y>=0))
  26. {
  27. b = b + 1;
  28. }
  29.  
  30. if ((z=='*')||(z=='V'))
  31. {
  32. h = z;
  33. }
  34. if((a != 20 )&& (b != 30) && (h != '0'))
  35. {
  36. matriz[a][b]= h ;
  37. printf("%c", matriz[a][b]);
  38. }
  39. };
  40. printf("a");
  41.  
  42. for(int i = 1;i<=8;i++)
  43. {
  44. printf("%d", i);
  45. for(int c = 1; c<=8; c++)
  46. {
  47.  
  48. printf("%c",matriz[i][c]);
  49. }
  50. printf("\n");
  51. }
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement