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;
- while (numb != 0) {
- cout << "Enter a number from 1 to 5: " << endl;
- cin >> numb;
- switch (numb)
- {
- case 1:
- cout << "Your number is: 1" << endl;
- break;
- case 2:
- cout << "Your number is: 2" << endl;
- break;
- case 3:
- cout << "Your number is: 3" << endl;
- break;
- case 4:
- cout << "Your number is: 4" << endl;
- break;
- case 5:
- cout << "Your number is: 5" << endl;
- break;
- default: "Please enter a valid number";
- }
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement