For example, draw a map now and use four colors: red, yellow, blue and green. For storage convenience, we specify 0= red, 1= yellow, 2= blue, and 3= green. But at a certain stage of programming, programmers may forget which number corresponds to which color, or how many numbers there are, so they will look up the table, which will delay time. At this point, you can define an enumeration type enumcolor {Red, yellow, blue, Green}, so that the system will automatically correspond 0, 1, 2,3 to each element in the enumeration type. Programmers only need to remember the words "red" and "green", and there will be no other numbers except "4".
However, there are many restrictions on the use of enumeration types. It is a separate data type, which can't be operated as simply as an array. Type conversion is often used, which is inconvenient to operate. It is rarely used in practical programming.