04-C-Selection - ECE 175: Computer Programming for...

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

View Full Document Right Arrow Icon
ECE 175: Computer Programming for Engineering Applications Selection Structures: if and switch Statements
Background image of page 1

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

View Full DocumentRight Arrow Icon
ECE 175: Computer Programming for Engineering Applications - Selection Structures Control structures Control the fow oF execution in a program C control structures Enables combining of individual instructions into a single logical unit The logical unit has one entry point and one exit point Three kinds oF control structures Sequence, selection, and repetition Sequence A compound statement written as a group of statements bracketed by { and } So far, we have been seeing only this kind Choose alternative statements by testing the value oF a variable Such statements are called "conditional" statements Establishes a criterion for either executing or skipping a group of statements 2
Background image of page 2
ECE 175: Computer Programming for Engineering Applications - Selection Structures Relational and equality operators Most conditions we employ will be of the following form Relational and equality operators 3 variable operator variable_or_constant Operator Meaning Type < less than relational > greater than relational <= less than or equal to relational >= greater than or equal to relational == equal to equality != not equal to equality
Background image of page 3

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

View Full DocumentRight Arrow Icon
ECE 175: Computer Programming for Engineering Applications - Selection Structures Sample conditions Sample data
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 13

04-C-Selection - ECE 175: Computer Programming for...

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