Dev-C++ program closes immediately after running

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
3 replies · 3K views
JamesU
Gold Member
Messages
828
Reaction score
3
Every time I compile and run a program in Dev-C++ Command prompt only opens for less than a second and closes immediately. can anyone help?
 
Physics news on Phys.org
START->RUN

Type: cmd (assuming your on windows xp)
Type: cd <directory where program is located>
Type: <program name>
 
Use getch() ?
Code:
#include<stdio.h>
#include<conio.h>
int main()
{
    printf("Hello World");
    getch();
    return 0;
}

-- AI
 
Programs run until they get to the end of the code, use getchar()