Created
December 23, 2013 14:41
-
-
Save mryoshio/8098239 to your computer and use it in GitHub Desktop.
enum in C++
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
using namespace std; | |
enum Color { | |
red, green, blue, | |
white = 10, black = white, | |
silver, gold = 99 | |
}; | |
int main() | |
{ | |
Color color = red; | |
cout << "red is " << color <<endl; | |
color = green; | |
cout << "green is " << color <<endl; | |
color = blue; | |
cout << "blue is " << color <<endl; | |
color = white; | |
cout << "white is " << color <<endl; | |
color = black; | |
cout << "black is " << color <<endl; | |
color = silver; | |
cout << "silver is " << color <<endl; | |
color = gold; | |
cout << "gold is " << color <<endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment