Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int x=0,y=0, aux=0, a = 20, b = 30;
- char z=0, h = 0;
- char matriz[8][8];
- FILE *ip;
- ip = fopen("joao.txt", "r");
- while(1)
- {
- aux = fscanf(ip,"%d %d %c", &x,&y,&z);
- printf("%d\n",aux);
- if(aux != 3)
- {
- break;
- }
- if((x<=7) &&(x>=0))
- {
- a = x + 1;
- }
- if((y<=7)&&(y>=0))
- {
- b = b + 1;
- }
- if ((z=='*')||(z=='V'))
- {
- h = z;
- }
- if((a != 20 )&& (b != 30) && (h != '0'))
- {
- matriz[a][b]= h ;
- printf("%c", matriz[a][b]);
- }
- };
- printf("a");
- for(int i = 1;i<=8;i++)
- {
- printf("%d", i);
- for(int c = 1; c<=8; c++)
- {
- printf("%c",matriz[i][c]);
- }
- printf("\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement