I write a program, and it closes itself after its execution.
I use the "cin.get();", the program should expect the user to type a key, but it doesn't works. So I have to use the "system("PAUSE")" but I prefer using cin.get();....
The problem that you might have is that there are still characters in the input buffer when the command is given. To fix this, you could put an ignore command right before cin.get() which will not pause if there are still characters to be read.
1 2
cin.ignore (BUFSIZ, '\n');
cin.get();
Having not seen the code, this is my best guess...
Another option is to just declare a variable and then just cin that variable right before returning in your main function. I have seen people do the following:
1 2 3 4 5 6 7
int main()
{
//blah blah blah
int closer;
cin >> closer;
return 0;
}