Question: Use the struct definition below to describe a rectangle. Assume the horizontal sides of the rectangle are parallel to the x axis and vertical sides

Use the struct definition below to describe a rectangle. Assume the horizontal sides of the rectangle are parallel to the x axis and vertical sides of the rectangle are parallel to the y axis, and that the coordinates of the rectangle are integral values. Write a C program to do the following: [1] The main function should first prompt the user for the coordinates of the rectangle and then read in those coordinates. [2] The main function should then call the function area to compute and return the area of the rectangle. [3] The main function should print the area of the rectangle. [4] The main function should then call the function perimeter to compute and return the perimeter of the rectangle. [5] The main function should print the perimeter of the rectangle.

struct point

{

int x, y;

};

struct rect

{

struct point ne, se, sw, nw;

};

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!