i think that gets(str) will do it for you. the gets stop when you press enter.
you have to include the #include <cstdio> also a header for gets to work.
But gets(), OTOH, is a buffer overflow waiting to happen. That and it is a C function. If you are programming in C++ then do things the C++ way --you'll get type checking and all sorts of neat stuff.