如何使C控制台应用程序等待才退出?
看来我找不到这个问题的任何解决方案,所以我问你。 C不支持iostream和console.ReadKey,除非我做错了什么,否则请提供帮助!
It seems that I can't find any solution to this problem, so I'm asking you. C doesn't support iostream and Console.Readkey unless i did something wrong, so please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
C
c ++
最糟糕的示例在许多网站上列出
请参阅
system(“ pape”);
C
C++
Worst Example Listed on Many Websites
See what's wrong with
system("pause");
您可以使用
getchar()
或getc(stdin)
读取字符。该控制台默认情况下是线条缓冲的(至少在Linux上),因此它意味着它将等待Enter
。You can use
getchar()
orgetc(stdin)
to read a character. The console is line buffered by default (at least on Linux) so it means it will wait forenter
.在您的代码顶部导入此内容:
然后您可以使用:
在括号中,您可以写几秒钟的时间,您希望您的程序暂停!
希望这会有所帮助(尽管我迟到了三个月)
import this at the top of your code:
then you can use:
in the brackets you can write for how many seconds do you want your program to pause!
Hope this helps (although Im 3 months late)