Structureassignment
Structureassignment
ECS/1427/23
#9. Write a program that defines a structure called rectangle with four vertices
(four points p1, p2, p3 and p4).
A point is a data structure consists of two member elements: the X-coordinate and
the Y-Coordinate. The program should accept the four vertices of the rectangle,
determine whether the rectangle is a square or not and also calculate its area and
circumference.
#include <iostream>
#include <cmath>
using namespace std;
cout << "Area of the rectangle: " << side1 * side2 << " square units" << endl;
cout << "Circumference of the rectangle: " << 2 * (side1 + side2) << " units" << endl;
return 0;
}