Hello all ... I am reading Accelerated C++ (Addison Wesley) and in this example:

What does the following program do if, when it asks you for input, you type two names (for example, Samuel Beckett)? Predict the behavior before running the program, then try it.


Code:
#include <iostream>
#include <string>

int main()
{
    std::cout << "What is your name? ";
    std::string name;
    std::cin >> name;
    std::cout << "Hello, " << name
              << std::endl << "And what is yours? ";
    std::cin >> name;
    std::cout << "Hello, " << name
              << "; nice to meet you too!" << std::endl;
    return 0;
}
I assumed it would print out Samuel and ask for another name. This is because earlier in the book they said std::endl flushes the buffer (I thought clearing out the space and Beckett).

Could someone please explain to my why Samuel is placed into name, output and then Beckett is output without another prompt?

TIA!