关于switch问题
#include "stdio.h"#include <math.h>
#include <iostream>
int main(void)
{
int a;
printf("please input interger number:\n");
scanf("%c",&a);
switch(a)
{
case 1 :printf("Monday\n");break;
case 2 :printf("Tuesday\n");break;
case 'c' :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");
}
system("pause");
return 0;
}
这个程序我输入c时,输出是error
但是我把int a;改为int a =0后,输出就是Wednesday了,这是什么原因