// Ch. 7 Demo Program #5 // Mr. Minich #include<iostream.h> int main() { int num1 = 0; // used in a switch structure example switch (num1) { case 0: cout << "0" << endl; break; case 1: cout << "1" << endl; break; case 2: cout << "2" << endl; break; default: cout << "none of the above" << endl; break; } switch (num1 = 5) { case 0: cout << "0" << endl; break; case 5: cout << "5" << endl; // forgot the break statement default: cout << "None of the above" << endl; break; }
// "None of the above" is displayed in addition to "5" because of the missing break statement. return 0; }// end of main