{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

208 Day 06 Selection2

208 Day 06 Selection2 - 4002-208 Intro to Prog[in C Day 06...

Info icon This preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
4002-208 Intro. to Prog. [in C++] Day 06 More on Selection
Image of page 1

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

View Full Document Right Arrow Icon
Expanded Conditions The condition of an if statement can contain the Boolean operators And && Or || Not ! 2 4002-208
Image of page 2
Truth Table for And Operator Given a condition b1 && b2 where b1 and b2 have a Boolean value, the result of the And operator is shown in the following table b1 b2 b1 && b2 False False False False True False True False False True True True 3 4002-208
Image of page 3

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

View Full Document Right Arrow Icon
Example of And Operator Test to see if x is between 1 and 22, inclusively if ( x >= 1 && x <= 22) The relation condition x >= 1 is evaluated (T or F) and then x <= 22 is evaluated (T or F). The And operator is applied. Test to see if t is between 4 and 12, exclusively if ( t > 4 && t < 12) 4 4002-208
Image of page 4