Q:

How to find adjacent points in a 3D space in c++

I have a couple of points in a 3D space, and I want to write a condition to determine whether two points are adjacent: are they only a single unit apart in the integer lattice?
I have a struct named Point that holds x,y and z coordinates. Then in the main function, I set the values for points a,b,c,d,e and push them into a vector. Then in the for loop I want to check if two points are adjacent or not. Currently I'm just checking if they are on the same axis, but I do not know how to proceed.
struct Point{
   int x;
   int y;
   int z;
};

int main(){
    // just a couple of points
    struct Point a;
    struct Point b;
    struct Point c;
    struct Point d;
    struct Point e;

    vector<Point> pointVector;

    a.x = 0 ; a.y = 0; a.z = 0;
    b.x = 0; b.y = 0; b.z = -1;
    c.x = 1; c.y = 0; c.z = -1;
    d.x = 1; d.y = -1; d.z = -1;
    e.x = 2; e.y = -1; e.z = -1;

    pointVector.push_back(a);
    pointVector.push_back(b);
    pointVector.push_back(c);
    pointVector.push_back(d);
    pointVector.push_back(e);

    for(int i = 0; i < 5; i++){
       if(pointVector[i].x == pointVector[i+1].x ||  // how to set the condition to check if two points are adjacent?
          pointVector[i].y == pointVector[i+1].y || 
          pointVector[i].z == pointVector[i+1].z  
       ) cout << "adjacent" << endl;
       else
         cout << "not adjacent" << endl;

    }

    return 0;
}

By adjacent I mean something like in this photo:

A:

Very briefly:
for each pair of points:
    if two of the three coordinates are equal AND
              the other coordinate differs by 1:
        then mark the pair as adjacent.

Iterating through point pairs is simple enough: the first point a walks through indices 0-(n-2); the second point b walks through indices from a's position through the end, n-1.
Checking adjacency is also easy, given integer coordinates.
diff = abs(a.x - b.x) + 
       abs(a.y - b.y) + 
       abs(a.z - b.z)

diff = 1 iff the points are adjacent. 

