Skip to content

Instantly share code, notes, and snippets.

@Jack2
Created November 6, 2012 15:01
Show Gist options
  • Save Jack2/4025240 to your computer and use it in GitHub Desktop.
Save Jack2/4025240 to your computer and use it in GitHub Desktop.
[C++]switch/case/break/default_example
#include <iostream>
using namespace std;
int main()
{
cout << "Press Any Number" << endl;
int input;
cout << "My Number : ";
cin >> input;
switch(input){
default :
cout << "Computer use only 0 & 1" << endl;
break;
case 0 :
cout << "You press Number 0" << endl;
break;
case 1 :
cout << "You press Number 1" << endl;
break;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment