SHARE
TWEET

Untitled

a guest Nov 12th, 2019 57 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 = 1;
  10.  
  11.     cout << "Press 0 to exit program" << endl << endl;
  12.  
  13.     while (numb != 0) {
  14.         cout << "Enter a number from 1 to 5: " << endl;
  15.         cin >> numb;
  16.    
  17.         if (numb >= 1 && numb <= 5) {
  18.             cout << "Your number is: " << numb << endl;
  19.         } else {
  20.             cout << "please enter a valid number" << endl;
  21.         }
  22.     }
  23.    
  24.     system("pause");
  25. }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top