黑马程序员技术交流社区
标题:
枚举补充之一
[打印本页]
作者:
lvguodong
时间:
2015-10-8 00:27
标题:
枚举补充之一
#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 MONDAY:
printf("TODAY IS MONDAY!\n");
break;
case TUESDAY:
printf("TODAY IS TUESDAY!\n");
break;
case WEDNESDAY:
printf("TODAY IS WEDNESDAY!\n");
break;
case THURSDAY:
printf("TODAY IS THURSDAY!\n");
break;
case FRIDAY:
printf("TODAY IS FRIDAY!\n");
break;
case SATURDAY:
printf("TODAY IS SATURDAY!\n");
break;
case SUNDAY:
printf("TODAY IS SUNDAY!\n");
break;
default :
printf("SYSTEM CAN NOT DISTINGUISH!\n");
}
return 0;
}
复制代码
作者:
jing397
时间:
2015-10-8 18:57
支持一下
作者:
杨志昆
时间:
2015-10-8 19:20
支持一下
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2