Hi,

I'm used to boolean operators and understand that they can be very useful, including in areas such as If...Then statements, etc. but I am thoroughly confused after reading the tutorial on the cprogramming site concerning If...Then statements which included some information on Boolean operators. I wrote a small program to try and test out what the author was saying and the results left me bewildered. Here is the code:

The first two make perfect sense - if you have one and your looking for the negation its gonna be 0 and the second one is going to be one. But why does one and zerio (1 && 0) equal 0 and one or zero equal (1 || 0) one? I'm guessing perhaps it is because a number cannot be 1 and 0 but it can be 1 or 0 thus 1 and 0 must be false (0) and 1 or 0 can be true?Code:`#include <iostream.h>`

int main()

{

cout<<(!1); // Not 1.

cout<<(!0); // Not 0.

cout<<(1 && 0);

cout<<(1 || 0);

return 0;

}

Respectfully,

David.