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.
1.4m articles
1.4m replys
5 comments
57.0k users