Homework Help: Help evaluating boolean number and arithmetic operators C++

1. Sep 4, 2010

ihatecats2014

1. The problem statement, all variables and given/known data
!( ((count<10) || (x<y)) && (count >=0) )
where count is equal to 0

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

3. 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: Sep 4, 2010
2. Sep 4, 2010

Filip Larsen

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.

3. Sep 4, 2010

ihatecats2014

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?

Share this great discussion with others via Reddit, Google+, Twitter, or Facebook