Boolean

Okay, me again sorry :(. I just don't know how to make code using boolean operators. am learning C++ from this site http://www.cprogramming.com/tutorial/lesson2.html . Link is there so you can see boolean operators when you scroll down at the end.

Where do i put this:

1
2
3
A. !( 1 || 0 )         ANSWER: 0	
B. !( 1 || 1 && 0 )    ANSWER: 0 (AND is evaluated before OR)
C. !( ( 1 || 0 ) && 0 )  ANSWER: 1 (Parenthesis are useful)
Lol you dont put that anywhere. It's just showing you what boolean value(1 or 0) each equation returns.
Put something like this in your code after you've read bit more tutorials

1
2
3
4
5
6
7
if (cond1 || cond2) {
// what is needed to do if condition returns 1
} else {
// What happens when condition is false (aka 0)
// optional part
}
Topic archived. No new replies allowed.