fflush(stdin);的行为是未定义的,C标准没有规定这种东西。你最好用int c;while ( (c = getchar()) != '/n' && c != EOF ) ;否则一换编译环境,可能就不一样了。