Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    1
    Thanks
    0
    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

    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
    Attached Files Attached Files

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,146
    Thanks
    203
    Thanked 2,547 Times in 2,525 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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •