Definition: enum type is a set of data can be customized by the user data type.
Note: bool type can be seen as a pre-defined C ++ language provides enumerated type.
1. The enumeration type definition
enum <enumerated type name> {<enumeration value table>};
2. Initialize
Each of the enumerated type enumeration value corresponds to an integer number, the default value of the first enumeration value is 0, followed by 1, it may be displayed in any number of shaping initialize a corresponding enumeration value , without the enumeration defined default value adding 1 to the integer corresponding to the enumeration of its previous value.
enum {Sun = Day 7, Mon = 1, Tue, Wed, Thu, Fri, SAT}
3. Definition of enumeration
<Enumeration type> <variable table>;
Or <enumeration type> {<enumeration value table>} <variable table>;
4. Use of enumeration variables
1) Assignment
2) comparison operation
MON <TUE result is true, when converted to integer arithmetic
3) arithmetic operations
d2 = d1 + 1; // error, since it results d1 + 1 is an integer
d2 = (Day)(d1 + 1);//true
4) Other
O: number of inputs can be int, using the switch, then the output copy or
Access the Classmark: day (0) it corresponds to the first sun enumeration value