确定一下while(getchar()!= '\n ') ; 是不是当字符为回车\n的时候,就什么都不做? [解决办法]\r 是回车 \n 是换行 while(getchar()!= '\n '); //意思是遇到换行就退出循环. [解决办法]\n 是换行 这个语句是遇到\n就跳出while循环。