I'm struggling with coding a-star search algorithm, I have to make it in c++, despite I'm not really familiar with it. I've decided to use classes and lists, but I have one problem. My code looks like this:
class gridPoint
{
public:
int x;
int y;
int field;
}
gridPoint mapa[20][20];
startX=1;
startY=1;
//code to set the values of attributes
int main(){
mapa[startX,startY] = 1;
list<gridPoint> listZ;
listZ.push_back(*mapa[startX,startY]);
}
To this point it seems to work, compiles and executes with no errors. Now I need to get somehow to this element of list, but I have really no clue how to do that. I've tried simply:
list<gridPoint>::iterator it = listZ.begin();
cout<<listZ[it].x;
or:
cout<<*it.x;
but it doesn't work, either with ".x" or without
Later I would need to find specific object in a list with specific value of attribute and/or delete it, but without this mentioned above, I couldn't do it anyway. Any clues, how to make it work?