2 Years
Discussion Span
Last Post by Ancient Dragon

If I understand you, console (output window) will close when C++ program ends in Visual Studio.

There are many ways to prevent it from doing that here are 2 basic ones.
Add one of those 2 lines at the end of your program just above return 0;

int x; cin >> x;




My mistake.. Its in opencv library.i have been working on opencv project and i did not realise that** this post is not for opencv**


In Visual Studio you can press Ctrl + F5 or Shift + F5 (I don't remember which one) instead of just F5 to run your application in a console window that does not close.

In most other IDEs the output will either show up in a tab or a window that does not close automatically without you having to do anything special.

I do not recommend changing your actual code to accommodate a quirk of your IDE.

This is c++, not c.

The OP did ask about stdio, not iostream, though.

Edited by sepp2k


So I thought it would be a part of C++ .

It is, but if this is really a c++ program the be consistent and use c++. If not, then this whole thread is in the wrong forum.

This article has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.