-3
Good morning! I need to do a random draw of the elements of the matrix to know if there is a boat (boat=1). As well as, at the end of 10 attempts need to print with (x) the successfully bombed positions, shots in the water (-), water (A), intáctos ships (N). It was complicated, but I have already managed to improve my program, but do not compile this part, please, if you can help me I am very grateful!
#include <stdio.h>
#include <stdlib.h>
int main()
{
char inimigo [4][4] = {{0,1,1,0,}
{1,0,1,0},
{1,1,0,1},
{0,0,1,0}};
char tabuleiro[4][4];
int i,j;
for (i=0; i<4; i++){
for(j=0; j<4; j++){
tabuleiro[i][j] = '.';
printf("%c", tabuleiro[i[j]);
}
printf("\n");
}
printf("Informe as coordenadas do tiro (linha/coluna):");
scanf("%d %d", &i &j);
}
As it is, I think the question is very broad because the correct answer is to write the entire program... It will be better to work it in modules (implement matrix; draw; position ships; shoot; etc) and come up with specific questions about each of them.
– brasofilo
Hello, the question has no way to be canceled. If it did not have a positive punctuation response it could be erased, but it is not the case. Therefore, I would suggest you bring this question closer to your original version as possible, in a way that does not invalidate the existing answer, and by creating a new question that makes it clear the difference to this one.
– Math