1 #include<stdio.h> 2 3 int main() 4 { 5 int day=0; 6 scanf("%d",&day); 7 switch(day) 8 { 9 case 1: 10 printf("星期一\n"); 11 break; 12 case 2: 13 printf("星期二\n"); 14 break; 15 case 3: 16 printf("星期三\n"); 17 break; 18 case 4: 19 printf("星期四\n"); 20 break; 21 case 5: 22 printf("星期五\n"); //switch多分支语句 23 break; 24 case 6: 25 printf("星期六\n"); 26 break; 27 case 7: 28 printf("星期七\n"); 29 break; 30 default: 31 printf("输入错误,请输入(1-7)\n"); 32 break; 33 } 34 return 0; 35 }