ok. so far i have this. it compiles, but doesn't check those 4 poinst...
Code:
#include <stdio.h>
#include <math.h>
typedef struct
{
int x;
int y;
} point;
typedef struct
{
point point1;
point point2;
point point3;
point point4;
} square;
typedef struct
{
point point5;
point point6;
} segment;
int main() {
square s1;
printf("Enter x1:\n");
scanf("%d", & s1.point1.x);
printf("Enter y1:\n");
scanf("%d", & s1.point1.y);
printf("Enter x2:\n");
scanf("%d", & s1.point2.x);
printf("Enter y2:\n");
scanf("%d", & s1.point2.y);
printf("Enter x4:\n");
scanf("%d", & s1.point3.x);
printf("Enter y3:\n");
scanf("%d", & s1.point3.y);
printf("Enter x4:\n");
scanf("%d", & s1.point4.x);
printf("Enter y4:\n");
scanf("%d", & s1.point4.y);
// point (x1,y1) distance to (x2, y2) should equal distance from (x2,y2) to (x3, y3)
//assuming x1,y1 is the top left, x2,y2 is the bottom left
int square = 0;
//x3, y3 is the bottom right
if ( (s1.point2.y-s1.point1.y) == (s1.point3.x-s1.point2.x) )
square++;
//x4, y4 is the top right
if ( (s1.point4.y-s1.point3.y) == (s1.point4.x-s1.point1.x) )
square++;
if ( (s1.point4.y-s1.point3.y) == (s1.point2.y-s1.point1.y) )
square++;
if ( (s1.point3.x-s1.point2.x) == (s1.point4.x-s1.point1.x) )
square++;
if (square == 4)
printf("It's a perfect square!");
}