C++ switch statement on int value
#include <iostream> using namespace std; int main()/*w ww. ja v a 2 s .co m*/ { int speed; //turntable speed cout << "\nEnter 3, 4, or 5: "; cin >> speed; //user enters speed switch(speed) //selection based on speed { case 3: cout << "3\n"; break; case 5: cout << "5\n"; break; case 4: cout << "4\n"; break; } return 0; }