# How do you do this one?

Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last
• 01-19-2008
Gwazi
How do you do this one?
!( ( 1 || 0 ) && 0 )
• 01-19-2008
laserlight
Treat 1 as true and 0 as false, then evaluate the boolean expression.
• 01-19-2008
Gwazi
yeh thats what i need help with lol. im doing the tutorial on c++ i got the other two down but this last one is tricking me.
• 01-19-2008
Codeplug
Which part is tricking you?

gg
• 01-19-2008
Salem
Do what with it?
• 01-19-2008
Gwazi
!( ( that part what do i do with the !
• 01-19-2008
laserlight
The ! symbol means logical not.
• 01-19-2008
Gwazi
yes i know that much but im stuck figuring it out...can you just show me how you would go about doing it?
• 01-19-2008
laserlight
Well, how would you evaluate (1 || 0)?
• 01-19-2008
Gwazi
as 1
• 01-19-2008
laserlight
So far so good. So how would you evaluate (1 && 0)?
• 01-19-2008
Gwazi
as 0.
• 01-19-2008
laserlight
Excellent. Just evaluate !0 and your problem is solved.

EDIT:
Strictly speaking, the result of (1 || 0) is true, not 1, and the result of (true && 0) is false, not 0.
• 01-19-2008
Gwazi
See i just didnt know the order of it all. Thanks alot!
• 01-19-2008
laserlight
No problem. Actually, with all those parentheses to group subexpressions the order of evaluation is no different from the arithmetic you used since elementary/primary school.

More tricky would be:
Code:

`!( 1 || 0 && 0 )`
... which evaluates to false instead.
Show 80 post(s) from this thread on one page
Page 1 of 2 12 Last