// switch.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "iostream.h" char response; void menu() { cout << " Sample Menu " << endl; cout << " A. Choice A " << endl; cout << " B. Choice B " << endl; cout << " C. Choice C " << endl; cout << endl; cout << "enter your choice: " << endl; cin >> response; } void FunctionA() { cout << "in case A" << endl; } int _tmain(int argc, _TCHAR* argv[]) { menu(); switch (response) //switch object must be an integral value { case 'A': FunctionA(); break; case 'B': cout << "in case B" << endl; break; case 'C': cout << "in case C" << endl; break; default: cout << "incorrect choice" << endl; } return 0; }