Or ???

This is a discussion on Or ??? within the C++ Programming forums, part of the General Programming Boards category; Hi This may sound really stupid, but how do you say or in C++ ? And is there a way ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    183

    Wink Or ???

    Hi

    This may sound really stupid, but how do you say or in C++ ? And is there a way of saying and / or ? I have looked through the tutorials, and not found anything, but there might be something I over looked.

    Cheers

  2. #2
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,801
    Bitwise and/or or logical and/or?

    Bitwise:
    and = &
    or = |

    Logical:
    and = &&
    or = ||
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    In addition, you can just use the keywords and and or in your program, they refer to logical and and logical or, although the && and || versions are much more common and therefore more clear.

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    The if-statement tutorial has some information on logical operations.

    Here's another tutorial which might be helpful.

    I recommend that you work your way through the tutorials, AND get your hands on a beginning C++ book.

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by Daved
    In addition, you can just use the keywords and and or in your program, they refer to logical and and logical or, although the && and || versions are much more common and therefore more clear.
    what ? and and or are not keywords. [edit]unless they are new in C99, in which case I am outdated[/edit]
    Last edited by Ancient Dragon; 12-13-2005 at 01:13 PM.

  6. #6
    ZuK
    ZuK is offline
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    yes they are.

  7. #7
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Link please. google for "c language keywords" does not show them.

  8. #8
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    They are "alternative representations" in C++, and are reserved just like keywords. I don't know about C. See section 2.11 Keywords (paragraph 2) in the C++ standard.

    http://www.devx.com/tips/Tip/13268
    Last edited by Daved; 12-13-2005 at 01:21 PM.

  9. #9
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Ok, I finally found them here (just in case anyone else wants to know). Daved: I didn't notice the link in your post

  10. #10
    Registered User
    Join Date
    Jan 2005
    Posts
    7,328
    I found it after posting and added it as an edit. Note that the sun link doesn't seem to match the standard.

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21