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 (X || Y) if (!C)

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

## This document was uploaded on 11/03/2011 for the course EAS 230 at SUNY Buffalo.

### Page1 / 10

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

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

View Full Document
Ask a homework question - tutors are online