#include enum weekdays( MON=1,TUE, WED, THU, FRL, SAT, SUN) enum weekdays day /定义枚举变量* char* daynamel]={""星期一","星期二","星期三","星期四", 星期五","星期六","星期日"}; for(day=MON; day<=SUN; day=(enum weekdays)(day+D)) printf(("第%2d天%l0sn"day, dayname[ day])
#include enum weekdays{MON=1,TUE,WED,THU,FRI,SAT,SUN}; main() { enum weekdays day; /*定义枚举变量*/ char*dayname[]={"","星期一","星期二","星期三","星期四", "星期五","星期六","星期日"}; for(day=MON;day<=SUN; day=(enum weekdays)(day+1)) printf("第%2d 天 %10s\n",day,dayname[day]); }