Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Switch
- // Oscar Neal 31/10/19
- #include <iostream>
- using namespace std;
- int main()
- {
- int numb;
- cout << "Press 0 to exit program" << endl << endl;
- cout << "Enter a number from 1 to 5: " << endl;
- cin >> numb;
- while (numb != 0) {
- cout << "Enter a number from 1 to 5: " << endl;
- cin >> numb;
- if (numb >= 1 && numb <= 5) {
- cout << "Your number is: " << numb << endl;
- } else {
- cout << "please enter a valid number" << endl;
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement