in this code i don't understand why teacher used sometimes +value, - value;
/******************************************/
// function void returnSquares(POINT point, int value)
void returnSquares(POINT point, int value) {
SQUARE tabSquares[4]; // table of squares that we are creating
int i;
// getting points of 4 squares
// for first square input point is point C
tabSquares[0].pointA.dimX = point.dimX - value;
tabSquares[0].pointA.dimY = point.dimY + value;
tabSquares[0].pointB.dimX = point.dimX;
tabSquares[0].pointB.dimY = point.dimY + value;
tabSquares[0].pointC.dimX = point.dimX;
tabSquares[0].pointC.dimY = point.dimY;
tabSquares[0].pointD.dimX = point.dimX - value;
tabSquares[0].pointD.dimY = point.dimY;
// for 2nd square input point is point D
tabSquares[1].pointA.dimX = point.dimX;
tabSquares[1].pointA.dimY = point.dimY + value;
tabSquares[1].pointB.dimX = point.dimX + value;
tabSquares[1].pointB.dimY = point.dimY + value;
tabSquares[1].pointC.dimX = point.dimX + value;
tabSquares[1].pointC.dimY = point.dimY;
tabSquares[1].pointD.dimX = point.dimX;
tabSquares[1].pointD.dimY = point.dimY;
// for 3rd square input point is point A
tabSquares[2].pointA.dimX = point.dimX;
tabSquares[2].pointA.dimY = point.dimY;
tabSquares[2].pointB.dimX = point.dimX + value;
tabSquares[2].pointB.dimY = point.dimY;
tabSquares[2].pointC.dimX = point.dimX + value;
tabSquares[2].pointC.dimY = point.dimY - value;
tabSquares[2].pointD.dimX = point.dimX;
tabSquares[2].pointD.dimY = point.dimY - value;
// for 4th square input point is point B
tabSquares[3].pointA.dimX = point.dimX - value;
tabSquares[3].pointA.dimY = point.dimY;
tabSquares[3].pointB.dimX = point.dimX;
tabSquares[3].pointB.dimY = point.dimY;
tabSquares[3].pointC.dimX = point.dimX;
tabSquares[3].pointC.dimY = point.dimY - value;
tabSquares[3].pointD.dimX = point.dimX - value;
tabSquares[3].pointD.dimY = point.dimY - value;
for (i=0; i<4; i++) {
printf("Square number %d\n",i); // now we print parameters of each point in current Square
printf("point A x= %0.2f y= %0.2f\n",tabSquares[i].pointA.dimX,tabSquares[i].pointA.dimY);
printf("point B x= %0.2f y= %0.2f\n",tabSquares[i].pointB.dimX,tabSquares[i].pointB.dimY);
printf("point C x= %0.2f y= %0.2f\n",tabSquares[i].pointC.dimX,tabSquares[i].pointC.dimY);
printf("point D x= %0.2f y= %0.2f\n",tabSquares[i].pointD.dimX,tabSquares[i].pointD.dimY);
}
}