Switch with no break

Post date: Jan 28, 2013 9:53:46 AM

#include <iostream>

using namespace std;

void main()


// This program demonstrates how a switch statement

// works if there are no break statements.

char choice;

cout << "Enter A, B, or C: ";

cin >> choice;

// The following switch statement is missing its break statements!

switch (choice)


case 'A':cout << "You entered A.\n";

case 'B':cout << "You entered B.\n";

case 'C':cout << "You entered C.\n";

default :cout << "You did not enter A, B, or C!\n";