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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started