#include
#include
void main()
{
char a[10];
char week_day[][10]={"sunday","monday","tuesday","wednesday","thursday","friday","saturday"};
printf("请输入一个星期的单词:\n");
gets(a);
int i;
for(i=0;i<7;i++)
{
if(strcmp(a,week_day[i])==0)
break;
}
if(i<7)
printf("%d\n",i);
else
printf("ERROR!\n");
}
——————
编译好了~~:)
#include
#include
void
main()
{
char
a[10];
char
week_day[][10]={"sunday","monday","tuesday","wednesday","thursday","friday","saturday"};
printf("请输入一个星期的单词:\n");
gets(a);
int
i;
for(i=0;i<7;i++)
{
if(strcmp(a,week_day[i])==0)
break;
}
if(i<7)
printf("%d\n",i);
else
printf("ERROR!\n");
}
——————
编译好了~~:)