{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

1_Review_5-1

# 1_Review_5-1 - 1 CIS 15AG Review Chapter 5 Selection Making...

This preview shows pages 1–2. Sign up to view the full content.

CIS 15AG Review Chapter 5: Selection – Making Decisions Logical expression an expression that can be either true or false . Logical expressions are created using relational and/or logical operators. Relational Operators: < <= > >= == != Logical Operators: Evaluation of logical expressions complement of == is != !(a == b) is a != b complement of < is >= !(a < b) is a >= b complement of > is <= !(a > b) is a <= b complement of && is || !(a && b) is ! a || !b (De Morgan's Rule) !(a || b) is ! a && !b Precedence/ Associativity Arithmetical Operators Relational Operators Logical Operators Assignment Operators 15 Right to left + plus - minus ! 14 Left to right * / % 13 Left to right + - 10 Left to right < <= > >= 9 Left to right == != 5 Left to right && 4 Left to right || 2 Right to left = += -= *= /= %= Expressions connected by && and/or || are evaluated left to right, and it is guaranteed that the evaluation will stop as soon as the truth or falsehood is known. n != 0 && a / n > 10 // when n is 0, a / n > 10 is not evaluated, because false and anything is false Two-Way Selection – a logical expression is evaluated; if it is true, one or more actions is/are executed, if it is false, another action or group of actions is executed. 1 not false true true false and false true false false false true false true or false true false false true true true true b b - a a > b a

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 5

1_Review_5-1 - 1 CIS 15AG Review Chapter 5 Selection Making...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online