Advertisement
Felanpro

Switch() statement

May 27th, 2016
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int choice;
  8.  
  9.     cout << "type in 1, 2 or 3." << endl;
  10.     cin >> choice;
  11.  
  12.     switch(choice)
  13.     {
  14.     case 1:
  15.         cout << "hey!" << endl;
  16.         break;
  17.  
  18.     case 2:
  19.         cout << "hello world!" << endl;
  20.         break;
  21.  
  22.     case 3:
  23.         cout << "Hey man!" << endl;
  24.         break;
  25.  
  26.     default:
  27.         cout << "ERROROROORORO" << endl;
  28.         break;
  29.  
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement