Help evaluating boolean number and arithmetic operators C++

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 2K views
ihatecats2014
Messages
30
Reaction score
0

Homework Statement


!( ((count<10) || (x<y)) && (count >=0) )
where count is equal to 0

Homework Equations


i don't think any equations here are necessary except maybe the precedence law

The Attempt at a Solution


they combined 'and' and 'or' which confused the heck out of me. How do i figure out if this is true or false? if there is 'and' operator then wouldn't the whole thing have to be true, but the 'or' component means that only one of the expressions has to be true for the whole thing to be true. I am confused, how do i evaluate this? Do i negate last?
thank you
 
Last edited:
Physics news on Phys.org
To evaluate an expression like this, you need to know the precedence of the involved operators. In this case, parenthesis are heavily used, so you can start by evaluating the inner-most parenthesis containing expressions with "count" and then work your way outward to the next level of parenthesis in succession by employing the logic of the involved operators.

If you loose track of all the parenthesis levels you may benefit from drawing the whole thing up as an expression tree first.
 
that is what my professor told me, just to be sure i have it down, the inner most expression in this case would be the first expression? then the second expression containing count and then the last one?