Visual Studio终止我的控制台应用程序的速度太快 [英] Visual Studio terminates my console application too fast
问题描述
当我在Visual Studio(只是一个简单的hello world应用程序)中执行程序时,它将终止并立即关闭控制台窗口,而不是等待我手动关闭它.为了解决这个问题,我在程序末尾添加了cin.get()
,但是我的教练刚刚告诉我,我不必这样做,并且他昨晚可以运行相同的程序而不必输入多余的行.
When I execute my program in Visual Studio (just a simple hello world app) it terminates and closes the console window immediately, rather than waiting for me to close it manually. I have gotten round this by including cin.get()
at the end of the program, but my instructor has just told me that I shouldn't have to do that, and that he was able to run the same program last night without having to enter the extra line.
这是Visual Studio安装程序中的东西吗?
Is this something in the setup of Visual Studio?
我尝试使用Ctrl + F5,但这只是使控制台消失得更快.
I've tried using Ctrl+F5, but that just makes the console disappear even faster.
推荐答案
这是设计使然,您的讲师不正确.尝试从文件夹视图启动.bat文件,您将获得完全相同的行为!
This is by design and your instructor is incorrect. Try launching a .bat file from a folder view and you get precisely the same behaviour!
您可以
-
设置断点
Set a breakpoint
通过询问用户输入
Console.Readline()
运行到光标
这篇关于Visual Studio终止我的控制台应用程序的速度太快的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!