char str[50]; while (scanf("%s", str)){ if (str[0] == '!') break; printf("%s\n", str); }
我在网页链接上测试你这段代码,是可以的。