有一些不合理的地方稍作修改
#include
int main()
{
char a[4];
int j=0;
char weekday[7][10]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; //这块之前有问题
scanf("%s",a);//这样更合理
for(j=0;j<7;j++)//while循环似乎没什么用,就去掉了
{
if(a[0]==weekday[j][0] && a[1]==weekday[j][1]) //这块之前有问题,应该是weekday[j][1]
{
printf("%s\n",weekday[j]);
break;
}
}
return 0;
}
笔记本没有办法运行,只是看了一下。
a[0]==weekday[j][0]&&a[1]==weekday[j][2]
0对0,1难道不是对1吗?
改成a[0]==weekday[j][0]&&a[1]==weekday[j][1]
修改后再看看吧?
最好贴一下输出结果。