大家给看看这个程序?
/*2012年10月17日8:37:04
目的:练习枚举。
*/
# include <stdio.h>
enum weekday
{
monday,tuesday,wednesday,thursday,friday,saturday,sunday
};
void f(enum weekday i)
{
switch (i)
{
case 0:
printf("monday!\n");
break;
case 1:
printf("tuesday!\n");
break;
case 2:
printf("wednesday!\n");
break;
case 3:
printf("thursday!\n");
break;
case 4:
printf("friday!\n");
break;
case 5:
printf("saturday!\n");
break;
case 6:
printf("sunday!\n");
break;
}
}
int main(void)
{
while(1)
{
enum weekday i;
scanf("%d", i);
f(i);
}
return 0;
}
为什么输入monday之后不能输出啊?