lect06 While Loops

lect06 While Loops - Switch Statements Also Called...

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

View Full Document Right Arrow Icon
Switch Statements Also Called Switch/Case Statement Just Case in Other Languages Selects Among Several Different Actions Can Only Select from Integer or Character If an Integer Value Is Matched, Statements under Control of that Case Block Are Executed
Background image of page 1

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

View Full DocumentRight Arrow Icon
Switch/Case Example int numPassengers; cout << “Enter Passengers: “; cin >> numPassengers; switch(numPassengers) { case 0: zeroPassengers(); break; case 1: onePassenger(); break; default: manyPassengers(); break; }
Background image of page 2
Switch Case Example char menuItem; cout << "Enter Menu Selection: "; cin >> menuItem; switch(menuItem) { case 'O': orderFunction(); break; case 'C': checkoutFunction(); break; default: errorFunction(); break; }
Background image of page 3

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

View Full DocumentRight Arrow Icon
Iteration Iteration (Looping)
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 7

lect06 While Loops - Switch Statements Also Called...

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