以下定义枚举类型正确的是()
A: enum
color={red, yellow, blue};
B: enum
color={“red”, “yellow”, “blue”};
C: enum
color{“red”, “yellow”, “blue”}
D: enum
color{red=3, yellow, blue};
A: enum
color={red, yellow, blue};
B: enum
color={“red”, “yellow”, “blue”};
C: enum
color{“red”, “yellow”, “blue”}
D: enum
color{red=3, yellow, blue};
举一反三
- 下列枚举类型的定义中,包含枚举值3的是( )。 A: enum test {RED, YELLOW, BLUE, BLACK}; B: enum test {RED, YELLOW=4, BLUE, BLACK}; C: enum test {RED=-1, YELLOW,BLUE, BLACK}; D: enum test {RED, YELLOW=6, BLUE, BLACK};
- 下面对枚举变量的定义中,正确的是( )。 A: enum color {red, blue, grenn} a, b; B: enum color={red, blue, green} a,b; C: enum color={"red", "blue", "green"} a, b; D: enum color {red, blue, green} a, b;
- 假设定义了:enum color {red=1, orange, yellow, green ,blue, purple, black};则blue的值是(
- 若有定义 enum color {red,yellow=2,blue,white,black} r=white; 执行 cout< 4
- 若定义enum color {red=2, yellow, blue, white};那么blue的值为___________。 A: 0 B: 2 C: 3 D: 4