Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Help need basic coder
12-20-2011, 07:27 PM #1
- Join Date
- Dec 2011
- Thanked 0 Times in 0 Posts
Help need basic coder
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
2 rectangles are placed on a single plane.
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.
* 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.)
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.
(first 2 lines of 200 lines)
1 1 3 4
2 3 6 7
(first line of 100 lines)
The sample data describes the following two rectangles:
can any one help to code this type progy
12-22-2011, 07:41 AM #2
- Join Date
- Jun 2002
- London, England
- Thanked 2,508 Times in 2,486 Posts
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.
All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.