C ++ - 控制台窗口打开? [英] C++ - Hold the console window open?
问题描述
我的问题是超级简单,但是我从C#转换到C ++,我想知道什么命令保持控制台窗口在C + +中打开?
My question is super simple, but I'm transitioning from C# to C++, and I was wondering what command holds the console window open in C++?
在C#中,最基本的方法是:
I know in C#, the most basic way is:
Console.ReadLine();
或者如果要让用户按任意键,其:
Or if you want to let the user press any key, its:
Console.ReadKey(true);
在C ++中如何做?我在这里问这个简单问题的唯一原因是,我在互联网上找不到一个很好的和明确的答案。
How do you do this in C++? The only reason I ask this simple of a question here, is that I haven't been able to find a good and clear answer out there on the internet.
推荐答案
std :: cin.get();
?
如果你使用Visual Studio,你可以运行没有调试(CTRL-F5默认),它不会关闭控制台在结束。如果你用调试运行它,你总是可以在 main()
的结束大括号上放置断点。
Also, if you're using Visual Studio, you can run without debugging (CTRL-F5 by default) and it won't close the console at the end. If you run it with debugging, you could always put a breakpoint at the closing brace of main()
.
这篇关于C ++ - 控制台窗口打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!