cin
is buffered input. You want "unbuffered" input. It can be different on different platforms, unless you work directly with files.
Something like this might help:
http://www.cplusplus.com/forum/beginner/3329/
[EDIT], Remember that use of "buffered" v. "un-buffered" is a design decision, and both are legitimate. The "default" for "buffered-input" on cin
makes a lot of sense, as the user will "backspace" to correct the input-line, and you don't want that "clutter" feeding your program. (And, in general, "buffered-input" like from files can be much more efficient.)