这么改,供参考:
#include<stdio.h> #include<string.h> int main() { char a[100]; while(gets(a)!=NULL && strcmp(a,"stop")!=0) { puts(a); } return 0; }