Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试寻找 fflush 的替代方法来清除 C++ 中的缓冲区。我正在编写一个 C++ 程序来分叉 3 个孩子并在 N 个循环中打印它们,但 O/P 的顺序不正确。尝试使用 cout<< flush 和 endl。有没有其他方法可以强制信息立即显示?谢谢。
这不是最佳的,但你可以使用 getchar(); cin.get();
getchar(); cin.get();