switch - Programming Switch command Prog Fundamentals...

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

View Full Document Right Arrow Icon
Programming Switch command
Background image of page 1

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

View Full Document Right Arrow Icon
2 Prog. Fundamentals: Switch command / Slide 2 Multiple Selection: The switch Statement value1 action 1 value2 action 2 value3 action 3 value4 action 4 multiway expression
Background image of page 2
2 Prog. Fundamentals: Switch command / Slide 3 Multiple Selection: The switch Statement Syntax: switch (<selector expression>) { case <label1> : <sequence of statements>; break ; case <label2> : <sequence of statements>; break ; case <labeln> : <sequence of statements>; break ; default : <sequence of statements>; }
Background image of page 3

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

View Full Document Right Arrow Icon
2 Prog. Fundamentals: Switch command / Slide 4 Multiple Selection: The switch Statement Meaning: Evaluate selector expression. The selector expression can only be: a bool, an integer, an enum constant, or a char. Match case label. Execute sequence of statements of matching label. If break encountered, go to end of the switch statement. Otherwise continue execution.
Background image of page 4
2 Prog. Fundamentals: Switch command / Slide 5 Multiple Selection: The switch Statement action action action action case 1 case 2 case 3 default
Background image of page 5

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

View Full Document Right Arrow Icon
2 Prog. Fundamentals: Switch command / Slide 6
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 11

switch - Programming Switch command Prog Fundamentals...

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

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