I am just starting to learn C++ and to keep the console window from closing in Visual Studios I read to add a breakpoint at the closing brace of main. What does that look like? Could someone give a quick example please? And please don't bag on me for using Visual Studios, I am just starting to learn C++ and plan on learning how to use different complilers in the future, I just need a specific answer to my specific question.
Asked
Active
Viewed 408 times
1
-
See http://stackoverflow.com/questions/4118073/how-to-stop-console-from-closing-on-exit or add std::cin.get(); in the end of your main() function. – Sceptical Jule May 09 '13 at 14:35
-
Possible duplicate of: http://stackoverflow.com/questions/6137009/microsoft-visual-studio-how-to-keep-the-console-open-without-manually-reading-i (Hit ctrl-f5, window stays open till you close it) – enhzflep May 09 '13 at 14:37
1 Answers
2
To set a breakpoint in Visual Studio, click in the left-hand margin. You should see a little red circle.
A breakpoint, regardless of your IDE, is a point in the code where a debugging tool inserts itself. When the program reaches the position indicated by the breakpoint, the program stops, and gives control to the debugger. This in turn allows you to see mid-execution details of the program (as well as preventing it from progressing further along in execution)
Useful reference guide to debugging in general (including breakpoints): http://www.codeproject.com/Articles/79508/Mastering-Debugging-in-Visual-Studio-2010-A-Beginn

KidneyChris
- 857
- 5
- 12