very begginer

I try to run a program and when I press enter to show the result the comand line is closing. What do i have to do?
Do you mean that you can't see the result? If it so, I would recommend adding #include "windows.h" at the top
and Sleep(2000) just before you return. Something like this:

1
2
3
4
5
6
7
8
9
10
11
#include "windows.h"
#include "whatever_you're_using"

int main(){

    \\Your code

     Sleep(2000);
return 0

}
Don't use Windows.h or Sleep.

See that thread I linked.
i tried also what is written there but still does the same
For testing purpose(in windows only)just write
system ("pause"); before return statement .
grumble grumble

All of these are suggested (and exposed as bad suggestions) in the thread I already linked to.

http://cplusplus.com/forum/beginner/1988/
Thank you very much
this is really working
Topic archived. No new replies allowed.