1.while语句 当结尾有scanf是可直接用scanf来做判断条件 scanf("%c",&ch); while (ch != '#') { ... scanf("%c",&ch); } //替换为 while ((ch = getchar()) != '#')