我运行的结果完全没有问题,但是提交就WA,在网上查了说是使用getchar();才可以,但是为什么用fflush(stdin);不行呢?请大佬指教!
下面贴上我的代码
-
#include <stdio.h>
int main() { char a,b,c,temp; while((scanf("%c%c%c",&a,&b,&c)) != EOF) { //getchar(); 使用这个就可以AC if(a < b) { temp = a; a = b; b = temp; } if(a < c) { temp = a; a = c; c = temp; } if(c > b && c < a) { temp = c; c = b; b = temp; } printf("%c %c %c\n",c,b,a); fflush(stdin); } return 0; }