Ch2_5 - Next Previous Section 2.5: Control statements...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Next Previous Section 2.5: Control statements Section 2.5: Control statements 11 Boolean operators Control statement blocks if else if else Section 2.5: Conditional Statements Next Previous Section 2.5: Control statements Section 2.5: Control statements 22 Boolean operators The nine Boolean operators < less than <= less than or equal to > greater than > = greater than or equal to = = equal to (easily forgotten dont use one = sign, or the consequences will be severe!) ! = does not equal && and (easily forgotten) Next Previous Section 2.5: Control statements Section 2.5: Control statements 33 Two examples (1,2) x = 1; y = 2; z = 3; if (x<y) a=5; if (y<z) b=5; if (z>y && y>x) a=1; if (z<y || x<y) b=1; if (z != x) b=2; // what do a and b equal? x = 1; y = 2; z = 3; if (y<x) { a=5; b=5; } else if (z>y && y>x) { a=2; b=1; } else { a = 3; b = 3; } // what do a and b equal? a=1 and b=2 a=2 and b=1 X X control_block_1.cp p control_block_2.cp p Next Previous Section 2.5: Control statements...
View Full Document

This note was uploaded on 05/19/2008 for the course ENGR 25 taught by Professor All during the Spring '08 term at Lehigh University .

Page1 / 10

Ch2_5 - Next Previous Section 2.5: Control statements...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online