SHARE
TWEET

Untitled

a guest Nov 12th, 2019 67 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.     cout << "Enter a number from 1 to 5: " << endl;
  14.     cin >> numb;
  15.  
  16.     while (numb != 0) {
  17.         cout << "Enter a number from 1 to 5: " << endl;
  18.         cin >> numb;
  19.    
  20.         if (numb >= 1 && numb <= 5) {
  21.             cout << "Your number is: " << numb << endl;
  22.         } else {
  23.             cout << "please enter a valid number" << endl;
  24.         }
  25.     }
  26.    
  27.     system("pause");
  28. }
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