Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement