You need to be using cin.getline function for string containing spaces.

Here is the signature of of the getline function.
istream& getline (char* s, streamsize n, char delim );

A pointer to an array of characters.
The maximum number of characters to store, including the ternimating null character.
The delimiter. The operation of extracting succesive characters is stopped when delimiter is read. This parameter is optional, if not specified the function considers '\n' the delimiter.
Return Value.
The function returns *this