Thread: AND OR and NOT

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    73

    AND OR and NOT

    I have been programming in C++ for several years now. However, somewhere along the line, I missed precisely what these do. Having done some assembly, I am aware of their low-level uses. Does C++ use them for soemthing else, or is it the same? I see people using them in if statements, ect. and I would really like to know what they are using them for. Thank you for your time! If it is too much trouble to explain it, I would be just as happy to get a link! Thanks! ^_^

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    & | ~ ^ (AND OR NOT XOR) are all low-level bitwise operations in C++, just as they are in assembly. Its && || and ! which are the logical operations, and not the bitwise.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    If X is True, (non zero) any Y is True then (X && Y) is True, if either is False, (zero), then (X && Y) is False. Boolean AND operation, as you say, often used in if() statements.

    If either X or Y is True, then (X || Y) is True, if both are False (X || Y) is False. Boolean OR operation, again used in if() statements amongst other things.

    If X is True, then (!X) is False, boolean NOT operation.

    That what you mean? Or was it bitwise operations?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Registered User
    Join Date
    Feb 2002
    Posts
    73
    Thank you both for your replies. I now understand what I did not before! I really apperciate it! ^_^

Popular pages Recent additions subscribe to a feed