I'm programming in C and I need some help: I' have a bidimensional vector ( n rows, 2 columns) and each rows represent the coordinates of an Element I want to put in a bigger bidimensional vector, something like battleship. Is it possible to give a name to each rows? For example, how can I give the name X to the first element of my smaller vector?
What I've to do is: the element in vector represents coordinate of an element in a bigger vector, so each rows represent an element. I compare to at once, and if their are neighbors and one of them is "X", also the other one become an "X" element. Something like that:
enter code here
int x,y;
for(int a=0; a<nbE; a++)
{
for(int i=1; i<n;i++)
{
x=vector[a][0]-vector[i][0];
if((x==1)||(x==-1)||(x==0))
{
y=vector[a][1]-vector[i][1];
if( (y==1)||(y==-1)||(y==0))
{
if (vector[a]="X") *That's the point*
vector[i]="X";
}
}
}
.......
}