#include<stdio.h>
#include<conio.h>
void main()
{
enum colorname{red,yellow,blue,white,black};
colorname color;
int i=0;
for(i=0;i<5;i++) //你的枚举变量怎么可以自加呢???
{
color=(colorname)i;//强制转换为colorname类型,枚举元素的下标从0开始的!
switch(color)
{
case red:printf("red\n");break;
case yellow:printf("yellow\n");break;
case blue:printf("blue\n");break;
case white:printf("white\n");break;
case black:printf("black\n");break;
}
}
}