SHARE
TWEET

Untitled

a guest Nov 12th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Switch
  2. // Oscar Neal 31/10/19
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     int numb;
  10.  
  11.     cout << "Press 0 to exit program" << endl << endl;
  12.  
  13.     do
  14.     {
  15.  
  16.         cout << "Enter a number from 1 to 5: " << endl;
  17.         cin >> numb;
  18.    
  19.         switch (numb)
  20.         {
  21.         case 1:
  22.             cout << "Your number is: 1" << endl;
  23.             break;
  24.         case 2:
  25.             cout << "Your number is: 2" << endl;
  26.             break;
  27.         case 3:
  28.             cout << "Your number is: 3" << endl;
  29.             break;
  30.         case 4:
  31.             cout << "Your number is: 4" << endl;
  32.             break;
  33.         case 5:
  34.             cout << "Your number is: 5" << endl;
  35.             break;
  36.         default: "Please enter a valid number";
  37.         }
  38.     } while (numb != 0);
  39.  
  40.    
  41.     system("pause");
  42. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top