如何阻止控制台在退出时关闭? [英] How to stop console from closing on exit?
问题描述
我正在使用 Visual Studio 2010 和 Windows 7 x64
I'm using Visual Studio 2010 and Windows 7 x64
命令提示符在退出后关闭,即使我使用了不调试就启动".有没有我可以使用的设置?
The command prompt closes after exit, even though I used "Start without debug". Is there a setting somewhere that I can use?
推荐答案
你可以直接按 Ctrl+F5 而不是 F5 来运行构建的代码.然后它会提示您按任意键继续.或者你可以在代码末尾使用这一行 -> system("pause");
让它等到你按下任意键.
You can simply press Ctrl+F5 instead of F5 to run the built code. Then it will prompt you to press any key to continue. Or you can use this line -> system("pause");
at the end of the code to make it wait until you press any key.
但是,如果你使用上面那行 system("pause");
并按 Ctrl+F5 运行,它会提示你两次!
However, if you use the above line, system("pause");
and press Ctrl+F5 to run, it will prompt you twice!
这篇关于如何阻止控制台在退出时关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!