解决的方式是在遇到r获取n的时候,替换为. #include<string.h> #include<stdio.h> int main(int argc, char *argv[]) { char str[128]; while (fgets(str, 127, stdin)) { char *tmp = NULL; //去掉换行符 if (tmp = strstr(str, "n")) *tmp = ''; //去掉回车符 if (tmp = strstr(st...