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 );

s
A pointer to an array of characters.
n
The maximum number of characters to store, including the ternimating null character.
delim
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