Thread: check this out?

  1. #1
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    check this out?

    Why is this like that?


    int i=1;
    int x=2.0

    What is the value and type of expression i/x?
    i said .5 double because ones a double which should make the whole thing a double, right. The correct answer was 0 int, WHY?
    someone please make me understand, please.
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Their both int's, just as it says in their declaration.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    TransparentMember correlcj's Avatar
    Join Date
    Jun 2002
    Posts
    378

    >Their both int's, just as it says in their declaration.

    Just smack me Hammer.
    It finally sunk in. That was a dumb ?
    Thanks anyway!
    cj
    "Be formless, shapeless, like water... You put water into a cup, it becomes the cup, you put water into a bottle, it becomes the bottle, you put it in a teapot, it becomes the teapot... Now water can flow, or it can crash, be water my friend."
    -Bruce Lee

  4. #4
    Unregistered
    Guest

    Lightbulb

    I havent seen anything like this before .............. Why dont u do some reading before posting any thing like this. Too many untrained people here.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. BN_CLICKED, change button style
    By bennyandthejets in forum Windows Programming
    Replies: 13
    Last Post: 07-05-2010, 11:42 PM
  2. how to check input is decimal or not?
    By kalamram in forum C Programming
    Replies: 3
    Last Post: 08-31-2007, 07:07 PM
  3. Please check this loop
    By Daesom in forum C++ Programming
    Replies: 13
    Last Post: 11-02-2006, 01:52 AM
  4. A way to check for Win98 or WinXP
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 10-31-2002, 11:06 AM
  5. how to check for end of line in a text file
    By anooj123 in forum C++ Programming
    Replies: 6
    Last Post: 10-24-2002, 11:21 PM