void Judgmonthday()
{
int iMonth;
printf("enter the month you want to know the days\n");
scanf_s("%d", &iMonth);
switch (iMonth)
{
case 1:
case 3:
case 5:
case 7:
case 10:
case 12:
printf("the day is 31\n");
break;//多路开关,多种情况执行统一语句
case 2:
printf("the day is 28\n");
break;
case 4:
case 6:
case 8:
case 9:
case 11:
printf("the day is 30\n");
break;
default:
printf("there is a error with your enter\n");
break;
}
}
C语言选择结构多路开关
最新推荐文章于 2024-07-23 14:02:12 发布