Skip to content

Instantly share code, notes, and snippets.

@mryoshio
Created December 23, 2013 14:41
Show Gist options
  • Save mryoshio/8098239 to your computer and use it in GitHub Desktop.
Save mryoshio/8098239 to your computer and use it in GitHub Desktop.
enum in C++
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