I am a new user to Dev C++ and I was compiling and executing my programs and as soon as I put in the last input, my dos window gives an answer and closes automatically. How do you keep that window open?
I am a new user to Dev C++ and I was compiling and executing my programs and as soon as I put in the last input, my dos window gives an answer and closes automatically. How do you keep that window open?
I never found a good way to do this.. but, i juse used a getch() to stop it at the end of execution
Is that air you're breathing?
Use getch() before your main returns. I don't use DevC++ but from previous posts I understand that getch() will work with it. Just make sure that you include conio.h (it may be conio.c with DevC++).
Basically a stripped down main with getch() would look like this:
Code:#include "conio.h" //like I said you may need to use conio.c int main() { printf("Hello World!"); getch(); return(0); }
Another possibility is:
Code:#include <stdlib.h> int main() { /*... do whatever you want to do ...*/ system("PAUSE"); //the program will wait for your input to close return 0; }
Regards,
Mario Figueiredo
Using Borland C++ Builder 5
Read the Tao of Programming
This advise was brought to you by the Comitee for a Service Packless World