just finished my program but now when i run only the executable as soon as i enter the filename and hit enter, the exe closes. any ideas what i need to do?
Printable View
just finished my program but now when i run only the executable as soon as i enter the filename and hit enter, the exe closes. any ideas what i need to do?
That's an extremely common problem. There are a few ways you can fix that problem:Quote:
Originally Posted by InvariantLoop
One is cin.get(), which is included in the <iostream.h> file, and another solution you can use <stdlib.h> and use system("pause"). Just call one of those functions right before you return from main.
how do u pause? give me an example, i put it in my code as follows
and still no go,Code:return 1;
system ("pause");
You need to put the pause before the return statement. And also, you should always return 0 if there wasn't an error.
Try swapping those two statements around.
No use pausing AFTER you return.
yep it works now. thanks again ehehe