] > Enumerated Types

2.9 Enumerated Types

<..enumType.cpp..>
 #include <iostream>
 using namespace std;
 
 int main ()
 {
    {
       enum color {red, yellow, green};  // default of 0, 1, 2
       color c = green;
       cout << c << endl;
    }
    {
       enum color {red = 5, yellow = 7, green = 90};
       cout << green << endl;
    }
    enum color {red = 5, yellow = 7, green};
    cout << green << endl;
 
    return 0;
 }
 
-_-_-