
Overview of C++ 243
8.18.3 Enumerated Data Type
The enum is a keyword. It is used for declaring enumerated data types. The programmer can declare new data
type and define the variables of these data types that can hold. For example, the user can define the material as
new data type. Its variable may be solid, liquid or gas. Thus, three values are restricted for this new data type.
These enumeration data types are useful in switch() case statement.
The syntax for enumerated data type is given below. It uses a keyword enum.
enum logical { false,true};
enum logical {true=2, false=4};
enum components{solid,liquid,gas};
This statement declares a ...