这题主要是加强switch的使用
#include <stdio.h>
int main()
{
char letter;
scanf("%s",&letter);
switch (letter) {
case'F':printf("Friday\n");break;
case 'M':printf("Monday\n");break;
case'W':printf("Wednesday\n");break;
case 'S':
printf("input second letter\n");
char letter2;
scanf("%s",&letter2);
if(letter2=='a')
printf("Saturday\n");
else if(letter2=='u')
printf("Sunday\n");
else printf("input error\n");
break;
case 'T':
printf("input second letter\n");
char letter3;
scanf("%s",&letter3);
if(letter3=='u')
printf("Tuesday\n");
else if((letter3=='h'))
printf("Thusday\n");
else printf("input error\n");
break;
default:printf("input error\n");break;
}
}
|