Thread: Please help me with my code

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    3

    Please help me with my code

    The problem has been solved, Thanks!
    Last edited by isuckatlife; 04-07-2008 at 12:13 PM. Reason: Problem solved

  2. #2
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    If left and right are to be believed, then (upper_left.x - lower_right.x) would be negative.

  3. #3
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by isuckatlife View Post
    \
    Here is an example of the terminal with the output:
    Enter the x coordinate for the top-left corner: 0
    Enter the y coordinate for the top-left corner: 2
    Enter the x coordinate for the bottom-right corner: 1
    Enter the y coordinate for the bottom-right corner: 4
    Now enter the x coordinate for a point: 3 //I am doing nothing with this yet
    Now enter the y coordinate for a point: 5 //I am doing nothing with this yet
    The area of the rectangle is: 2.000000117 //the answer should just be 2 right? why the strange decimals?
    No matter what, I always get 2.000000 with that input (even throwing more decimals in the mix). You should note, though, that %lf is not used to print a double. (It's supposed to have no effect, as though you had typed %f instead.)

  4. #4
    Registered User
    Join Date
    Apr 2008
    Posts
    3
    Ok, I see that now. I will fix that but since I did it for both x and y so they will both be negative which will give me a positive. I still get the strange decimals.

  5. #5
    Registered User
    Join Date
    Apr 2008
    Posts
    3
    OK, now it is working perfectly. Thank you for your help, I don't know why I was getting the strange decimals before. I changed the %lf to %f. Thanks for pointing that out

  6. #6
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    -_-

    Do not erase your post just because your problem has been solved - how the hell does that help other people that might run into the same problem?

    Jesus. It is as if some people do not think before acting.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extended ASCII Characters in an RTF Control
    By JustMax in forum C Programming
    Replies: 18
    Last Post: 04-03-2009, 08:20 PM
  2. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  3. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 0
    Last Post: 02-21-2002, 06:05 PM