5-Booleans - while(w>= 2.0 ||(q>= 4.0 if x is less...

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

View Full Document Right Arrow Icon
Image of page 1

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

View Full Document Right Arrow Icon
Monday Oct 17 In class Multiple Choice Short answer program questions Closed book Four exam versions
Image of page 2
+ - * /
Image of page 3

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

View Full Document Right Arrow Icon
Operator Meaning == Equality != Non equality < Less than > Greater than <= Less than or equal to >= Greater then or equal to Relational Operators are used to compare two values to determine how they relate to each other Examples: (A == B) (X < Y)
Image of page 4
in “if” statements if ( A == 6 ) { in “while” and “do..while” while (Loopcounter < 1000 ) {
Image of page 5

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

View Full Document Right Arrow Icon
Operator Meaning ! Not && And || Or Logical Operators are used to link expressions (including relational expressions) together Examples: if (A && B) if (X || Y) if (!C)
Image of page 6
if (( x<0 ) && ( y >= 10))
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
Image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: while ((w >= 2.0) || (q >= 4.0)) if x is less than 0, AND y is 10 or greater w is 2 or greater, OR q is 4 or greater int x = 4; cout << x ; yields 4 cout << ( x == 4 ); yields true however, in the computer, true is represented by 1, false is represented by 0 A B A && B F F F F T F T F F T T T A B A || B F F F F T T T F T T T T if (A && B) … both A AND B have to be true for the if statement to pass if (A || B) … EITHER A OR B have to be true for the if statement to pass bool B, S, W, A; // burglar, smoke, water, alarm A = B || S || W; // makes sense?...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern