Created
March 17, 2017 08:50
-
-
Save gpetuhov/2830a8e94d1ea43d6e3e707851ce9097 to your computer and use it in GitHub Desktop.
C++ Switch example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main() { | |
int x = 0; | |
cout << "Enter X" << endl; | |
cin >> x; | |
switch (x > 0) { | |
case true: | |
cout << "X > 0" << endl; | |
break; | |
case false: | |
cout << "X <= 0" << endl; | |
break; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment