Question: C++ programming A rectangle is completely determined by the coordinates of two of its diagonally opposite corners. For example, the points (1, 2) and (7,

C++ programming

A rectangle is completely determined by the coordinates of two of its diagonally opposite corners. For example, the points (1, 2) and (7, 5) determine a rectangle whose left edge has equation x = 1, whose right edge has equation x = 7, whose bottom edge has equation y = 2 and whose top edge has equation y = 5. Any point whose x-coordinate is between 1 and 7 and whose y-coordinate is between 2 and 5 lies within this rectangle.

Write a program that determines whether or not a given point is contained in a given rectangle.

Your program should:

Prompt the user for the upper left corner of a rectangle.

Prompt the user for the lower right corner of the rectangle.

Prompt the user for the coordinates of a point.

Output whether or not the point is inside the rectangle.

Repeat the above steps until the user enters (0, 0) for both corners of the rectangle.

Assume that all coordinates are non-negative integers with (0, 0) being the extreme upper-right corner.

Be readable with appropriate documentation and formatting.

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!