5-Booleans

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

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

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

View Full Document
Monday Oct 17 In class Multiple Choice Short answer program questions Closed book Four exam versions
+ - * /

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

View Full Document
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)
in “if” statements if ( A == 6 ) { in “while” and “do..while” while (Loopcounter < 1000 ) {

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

View Full Document
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)
if (( x<0 ) && ( y >= 10))

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

View Full Document

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.

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

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern