黑马程序员技术交流社区
标题:
枚举特点之二
[打印本页]
作者:
lvguodong
时间:
2015-10-6 00:20
标题:
枚举特点之二
#include <stdio.h>
int main()
{
enum week
{
MONDAY = 1,
TUESDAY,
WEDNESDAY,
THURSDAY,
FRIDAY,
SATURDAY,
SUNDAY,
};
int h;
printf("请输入1-7任意一个整数!\n");
scanf("%d",&h);
enum week day=h;
switch(day)
{
case 1:
printf("TODAY IS MONDAY!\n");
break;
case 2:
printf("TODAY IS TUESDAY!\n");
break;
case 3:
printf("TODAY IS WEDNESDAY!\n");
break;
case 4:
printf("TODAY IS THURSDAY!\n");
break;
case 5:
printf("TODAY IS FRIDAY!\n");
break;
case 6:
printf("TODAY IS SATURDAY!\n");
break;
case 7:
printf("TODAY IS SUNDAY!\n");
break;
default :
printf("SYSTEM CAN NOT DISTINGUISH!\n");
}
return 0;
}
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2