i coded it in VS2010.
i compiled it, and i copy the .exe file
i execute the exe file, it closes straight.
its the same as you simply press F5 in VS2010...
I am using Code::Blocks, I build and run, success. Did you try what I typed? I am not 100% what your problem is. You may have to reinstall your IDE, but that is becoming an all too common solution from me. You can run other programs fine though right? This one is the only program not working?
Yes. The newline character ("\n") represents the 'enter' key. You don't see it, but it is there.
If your curious, you can do: cout << "\nhello\nworld"; and see the line separations.
When you input something to standard input via the keyboard, the enter (return key) is read in as a '\n' and stored in the buffer (usually). There are times when the \n is left in the stream, and not input into the variable, where cin.ignore() comes in handy - this takes one character off of the stream (in this case, the one '\n' character).