#include /* This program illustrates the switch statement. It takes an integer representing a course number as input, and outputs the corresponding course name, or "no such course" if there is no match. */ main() { int number; /* course number entered by user */ /* Prompt for course number */ cout << "Enter a course number: "; cin >> number; /* This switch statement is used to match the course number with a course name. */ switch(number) { case 2610: /* number == 2610 */ cout << "Programming and Problem Solving\n"; break; /* Exit the switch */ case 2617: /* number == 2617 */ cout << "Data Structures and Objects\n"; break; case 3701: cout << "Advanced Object-oriented Programming\n"; break; default: /* number was neither 2610, 2617, or 3701 */ cout << "No such course!\n"; } /* end of switch */ }