输入相应的阿拉伯数字显示星期几,为什么这样的代码无法运行。求指导~
#include <stdio.h>int main()
{
struct Week
{
char Mon;
char Tue;
char Wed;
char Thu;
char Fri;
char Sat;
char Sun;
};
struct Week_1;
struct Week*p;
p=&stu_1;
stu_1.Mon="Monday"; //给stu_1赋值
stu_1.Tue="Tuesday";
stu_1.Wed="Wednesday";
stu_1.Thu="Thursday";
stu_1.Fri="Friday";
stu_1.Sat="Saturday";
stu_1.Sun="Sunday"; //同上
int i;
scanf("%d"&i);
switch(i)
{
case 1:printf("%s",(*p).Mon);break;
case 2:printf("%s",(*p).Tue);break;
case 3:printf("%s",(*p).Wed);break;
case 4:printf("%s",(*p).Thu);break;
case 5:printf("%s",(*p).Fri);break;
case 6:printf("%s",(*p).Sat);break;
case 7:printf("%s",(*p).Sun);break;
}
return 0;
}