Why does cout has to be flushed before cin starts reading? Aren't they of different buffer? I can have reading of input into a buffer while same time putting it on output buffer (before flushing) .. 2 different buffers. I am confused here.
The canonical example is this:
std::cout << "Enter your name: "; std::string name; std::cin >> name;
You do want to see the prompt before the input, that's why those two streams are tied together.
2.1m questions
2.1m answers
60 comments
57.0k users