第二个输入字符的语句为何无法实现?
#include"stdio.h"void main()
{
//char monday tuesday wednesday thursday friday saturday sunday;
char x, letter;
int i;
printf("请输入字母:\n");
scanf("%c", &x);
if(x == 'm')
printf("Monday\n");
else if(x == 'w')
printf("Wednesday\n");
else if(x == 'f')
printf("Friday\n");
else if(x == 't')
{
printf("请再输入第二个字母:\n");
if((letter = getchar()) == 'h')
printf("Thursday");
else if((letter = getchar()) == 'u')
printf("Tuesday");
else
printf("error input");
}
else if(x == 's')
{
printf("请再输入第二个字母:\n");
if((letter = getchar()) == 'u')
printf("sunday");
if((letter = getchar()) == 'u')
printf("saturday");
else
printf("error input");
}
else
printf("error input");
}