...

View Full Version : Help need basic coder



DO0n
12-20-2011, 07:27 PM
HI to All COding fourm team and member i need help
i have Project


Input File: boxin.txt (attached to post)
Output File: boxout.txt

Situation

2 rectangles are placed on a single plane.

Task

Write a program that calculates the area covered by the 2 rectangles.
Note that the two rectangles may overlap! The overlapping areas should only be counted once.
Your program should read from the input file and print the correct answers to the output file.

Input

* You need to download the provided input file.

The input file will consist of 100 scenarios, 2 lines each, in order. (total 200 lines)

For each 2 consecutive lines:
The first line will be of the form "x1 y1 x2 y2", representing the coordinates of the bottom-left and top-right corners of one rectangle, respectively.
The second line will also be of the form "x1 y1 x2 y2", representing the coordinates of the bottom-left and top-right corners of the other rectangle.

You are guaranteed that for each rectangle, 0 <= x1 < x2, and 0 <= y1 < y2. (That is, each rectangle is at least one unit square in size.)

Output

Your output file should consist 100 lines, each line being the the answer to a single scenario, in order.
Each line should be a single integer representing the area covered by the 2 rectangles.

Sample Input

(first 2 lines of 200 lines)

1 1 3 4
2 3 6 7

Sample Output

(first line of 100 lines)

21


Sample Explanation

The sample data describes the following two rectangles:
http://i40.tinypic.com/3038l4z.png

can any one help to code this type progy

Philip M
12-22-2011, 07:41 AM
Sorry, we will not do your homework for you.. See forum rule #1.5.

It is not really in your best interests that others do your all or most homework for you. Your teacher may gain a false and
exaggerated idea of your programming capabilities and so not offer you the support you need.
Also, if you hand in other people's work which you do not completely understand, then you will start to fall behind and
your difficulties will increase. So really you are really cheating yourself.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum