You can also run your program by going to the command prompt and typing in it's name and the command prompt won't close.
Console programs aren't realy designed to be double clicked which is why they close.