Skip to content

Latest commit

 

History

History
48 lines (46 loc) · 644 Bytes

31.md

File metadata and controls

48 lines (46 loc) · 644 Bytes

题目:请输入星期几的第一个字母来判断一下是星期几,如果第一个字母一样,则继续判断第二个字母。

#include<stdio.h>

int main()
{
	char c1, c2;
	scanf("%c", &c1);
	switch (c1)
	{
	case 'M':
		printf("Monday");
		break;
	case 'T':
		getchar();
		scanf("%c", &c2);
		if (c2 == 'u')
		{
			printf("Tuesday");
		}
		else
		{
			printf("Thursday");
		}
		break;
	case 'W':
		printf("Wednesday");
		break;
	case 'F':
		printf("Friday");
		break;
	case 'S':
		getchar();
		scanf("%c", &c2);
		if (c2 == 'a')
		{
			printf("Saturday");
		}
		else
		{
			printf("Sunday");
		}
		break;
	}

	return 0;
}