How to add timer and pause after program in Vscode

I was using Dev-c++ before, and it will automatically add
"--------------------------------
Process exited after 1.437 seconds with return value 0"
after running my code

Now I use vscode to code as devc++ can't auto-completion when using "#include<bits/stdc++.h>", I enabled the "external Console" setting and now vscode can run my code in console but it doesn't add anything in the end, so if my program needs no input the console will flash for a second and close itself quickly, so I can't do my debug. And I don't want to add extra input in the end of my code, as I will type many code in the future.

Please tell me how to add tips in vscode like in devc++ without changing my original code.
Last edited on
https://www.cplusplus.com/forum/beginner/1988/

the timer and return value are complex. the return value is simple to know: did you actually add error handling in the program so that main has return 1, return 2, ... statements instead of return 0? If not, it returns 0.
the timer needs you to code something to track time and display it, which there are plenty of examples (see <chrono>) but if you have to ask its too complex to fool with as a beginner.

as to closing, the easy thing to do is just add a bogus cin statement.
I run a console, so it does not close when done... that is another easy way.
Topic archived. No new replies allowed.