Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要在 C 中实现该程序,该程序从标准输入读取未知数量的行。我知道最大行数是100。我尝试使用gets,但我不知道何时停止循环。你能告诉我如何实施吗?
gets
这取决于您希望程序何时停止。有几种常见的方法:
^C
QUIT
EXIT
Enter
由于您的情况下的最大数量为 100,因此您可以将其用作限制,以在达到最大值后自动终止输入。