The standard streams cin and cout are automatically tied to each other. This means that whenever you’re using both of them, C++ ensures that their operation is synchronized. In other words, if you have
cout << "enter your name: ";cin >> name;
C++ ensures that cout displays the message on the screen before cin will wait for input, even if you don’t use an explicit flush operation or the endl manipulator. Therefore, whenever you display a message before accepting input, you can be sure that the output will appear before the system performs the input operation.