-
Notifications
You must be signed in to change notification settings - Fork 205
/
pg312_q009.c
17 lines (16 loc) · 871 Bytes
/
pg312_q009.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>
int main (int argc, char* argv[] ){
/* Write a program that:
* Defines a struct point that has x and y coordinates as its members
* Defines a struct square that stores 4 vertices of the square
* Reads x and y coordinates, in that order, of each vertex of a square.
* Assume vertices are input in clockwise order from the user.
* One coordinate per line - total 8 coordinates
* Validates if the input coordinates indeed make a square.
* In case the coordinates are wrong, program prints "Invalid input" without quotes and trailing newline and exits
* If input was valid, print perimeter of the square followed by a single space followed by area of the square.
* Perimeter and area should have two decimal points
* There should be no trailing whitespace or newline on the output line
*/
return 0;
}