+ 1
When I am making a simple programme called Hello World!
My programme is open and close immediately! I am writing same as shown in this application. why this is happening?
6 odpowiedzi
+ 4
i think you r using turbo c++, if so,
then include <conio.h> headerfile,
and use function getch();
whenever (or wherever) you want to hold your output screen.
+ 2
add
getch();
before
return 0;
+ 2
Thanks Nikhil
+ 2
You can also use cin.get(); an alternative I recently learned as an alternative of getch(); also getch() doesn't work if you're coding in VisualBasic so use _getch(); instead. Happy Coding.
+ 1
It does that because the program runs so fasts that the console window shows up, writes the stuff and closes immediately. This is intended and could be countered with functions that wait for input (cin, getch) or an endless cycle.
Or you could run your program from console window (linux style) and that would stay until you manually close it.
+ 1
are u am good developer???