问大家一个关于C语言的小问题
#include<stdio.h>void main()
{int a;
printf("input integer number:");
scanf("%d",&a);
switch(a>1?2:3)
{
case 1:printf("Monday\n");break;
case 2:printf("Tuesday\n");break;
case 3:printf("Wednesday\n");break;
case 4:printf("Thursday\n");break;
case 5:printf("Friday\n");break;
case 6:printf("Saturday\n");break;
case 7:printf("Sunday\n");break;
default:printf("error\n");
}
getch();
}
我用WIN-TC大于7以上的数都会输出Tuesday,我不懂的是switch(a>1?2:3)这个是怎么算的?