Hey guys,how can i retain the output window when stdio is used as my header?

you mean after your program exists? run your program in a console window instead of from within the IDE.

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;



Waits for a pressed key.
C++: int waitKey(int delay=0)

Huh? There is no such c++ function as waitKey.

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**

You can use getchar()
It will wait for a to be pressed for terminating the program .

getchar() is a C function that C++ inherited.
So I thought it would be a part of C++ .

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.

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.