1 #include<stdio.h> 2 void judge(int days); 3 int main() 4 { 5 int days; 6 printf("请输入今天是一周的第几天: "); 7 scanf("%d",&days); 8 judge(days); 9 getchar(); 10 getchar(); 11 return 0; 12 } 13 void judge(int days) 14 { 15 switch(days) 16 { 17 case 1:printf("周一");break; 18 case 2:printf("周二");break; 19 case 3:printf("周三");break; 20 case 4:printf("周四");break; 21 case 5:printf("周五");break; 22 case 6:printf("周六");break; 23 case 7:printf("周日");break; 24 default:printf("输入错误,请重新输入:"); 25 scanf("%d",&days);judge(days);break; 26 } 27 28 }