#include<stdio.h>
int main()
{
int day;
printf("输入星期:");
scanf("%d",&day);
switch(1)
{
case1:
case2:
case3:
case4:
case5:
printf("上班");
break;
case6:
case7:
printf("休息");
break;
default:printf("6");
break;
}
return 0;
}
输入星期:9
6
--------------------------------
Process exited after 2.954 seconds with return value 0
Press any key to continue . . .
值得注意的是switch语句中的default子句可以放在任何位置,defaulr是在所有其他的语句不能运行时才运行