Calculate Smallest Bounding Rectangle Area - Cartesian Coordinates Program

  • Thread starter Thread starter s_chaursia
  • Start date Start date
s_chaursia
Messages
3
Reaction score
0
Given the Cartesian coordinates of n (> 0) 2-dimensional points, write a program that
computes the area of their smallest bounding rectangle (smallest rectangle containing all the
given points).
Input
The input file may contain multiple test cases. Each test case begins with a line
containing a positive integer n (< 1001) indicating the number of points in this test case.
Then follows n lines each containing two real numbers giving respectively the x- and y
coordinates of a point. The input terminates with a test case containing a value 0 for n which
must not be processed.
Output
For each test case in the input print a line containing the area of the smallest bounding
Rectangle rounded to the 4th digit after the decimal point.
Sample Input
3
-3.000 5.000
17.000 9.000
17.000 5.000
4
10.000 10.000
10.000 20.000
20.000 20.000
20.000 10.000
0
Sample Output
80.0000
100.0000
 
Physics news on Phys.org
Once again, please read the guide lines for this forum. No one here is going to do your work for you. If you want help, make a good effort, show us what you have done and where you got stuck and we will try to help.
 

Similar threads

Replies
6
Views
2K
Replies
1
Views
2K
Replies
21
Views
3K
Replies
7
Views
3K
Replies
2
Views
2K
Replies
1
Views
1K
Replies
16
Views
3K
Back
Top