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
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
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
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.
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.
what ? and and or are not keywords. [edit]unless they are new in C99, in which case I am outdated[/edit]Originally Posted by Daved
Last edited by Ancient Dragon; 12-13-2005 at 02:13 PM.
yes they are.
Link please. google for "c language keywords" does not show them.
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 02:21 PM.
Ok, I finally found them here (just in case anyone else wants to know). Daved: I didn't notice the link in your post
I found it after posting and added it as an edit. Note that the sun link doesn't seem to match the standard.