程序代码:
#include<stdio.h> main() { char ch; //不是chair! scanf("%c%*c",&ch); if(ch=='m')printf("Monday"); //注意少了个f else if(ch=='w')printf("Wednesday"); else if(ch=='f')printf("Friday"); else if(ch=='t') { scanf("%c%*c",&ch); //%*c意思是输入的字符不存储到任何变量中,也可以起到过滤回车的功效 if(ch=='u') printf("TUesday"); else printf("THursday"); } else if(ch=='s') { scanf("%c%*c",&ch); if(ch=='a')printf("SAturday"); else printf("SUnday"); } printf("\n"); }