#include<stdio.h>
void main()
{
char day;
printf(“please input the first letter of week.\n”);
day=getchar();
switch(day)
{
case ‘m’:printf(“monday\n”);break;
case ‘t’:printf(“please input second char\n”);
day=getchar();
if(getchar()==’u')
printf(“tuesday\n”);
else if(getchar()==’h')
printf(“thursday\n”);
else
printf(“date error\n”);
break;
case ‘W’:printf(“wednesday\n”);break;
case ‘S’:printf(“please input second char\n”);
day=getchar();
if (getchar()==’u')
printf(“sunday\n”);
else if(getchar()==’a')
printf(“saturday\n”);
else
printf(“date error”);
break;
case ‘F’:printf(“friday\n”);break;
default:printf(“date error\n”);
}
}
>> 本文固定链接: http://www.vcgood.com/archives/3351
void main()
{
char day;
printf(“please input the first letter of week.\n”);
day=getchar();
getchar();
switch(day)
{
case ‘m’:printf(“monday\n”);break;
case ‘t’:printf(“please input second char\n”);
day=getchar();
getchar();
if(day==’u')
printf(“tuesday\n”);
else if(day==’h')
printf(“thursday\n”);
else
printf(“date error\n”);
break;
case ‘w’:printf(“wednesday\n”);break;
case ‘s’:printf(“please input second char\n”);
day=getchar();
getchar();
if (day==’u')
printf(“sunday\n”);
else if(day==’a')
printf(“saturday\n”);
else
printf(“date error”);
break;
case ‘f’:printf(“friday\n”);break;
default:printf(“date error\n”);
}
}