#include<stdio.h>#include<stdlib.h>#include<time.h>int main (void){
enum Week {
sun, mon,tue, wed, thu, fri, sat};enum Week today;struct tm *p;time_t t ;time(&t);p =localtime(&t);today = p->tm_wday;switch(today){
case mon:case tue:case wed:case thu:case fri:printf("干活!T_T\n");break;case sat:case sun:printf("放假!^_^\n");break;default:printf("Error\n");}}
#include<stdio.h>#include<stdlib.h>#include<time.h>int main (void){
//若在中间定义,开头变量任从0开始enum Color {
red =10, green, blue};enum Color rgb;for(rgb = red; rgb <=blue; rgb++){
printf("rgb is %d\n",rgb);}return0;}