|
10 | 10 | -`std::ios_base::sync_with_stdio(false)`: by default, C++ works with C++ iostreams (like`std::cin`) and C style stdio streams (like`stdin`) by synchronizing them.
|
11 | 11 | Since you should never need C style I/O (like`scanf`,`printf`), in C++, disabling this synchronization will make C++ I/O competitive with C style`scanf`.
|
12 | 12 | -`std::cin.tie(0)`: By default, iostreams flush cout every time you read from cin, so that you will always display any output before reading any input.
|
13 |
| -If you are not solving an interactive problem, i.e. you don't require interleavinginputs and outputs, you candisable this automatic flushing to make I/O faster. |
| 13 | +You can disable this automatic flushing to make I/O faster. The exception is for interactive problems with interleavedinputs and outputs,for whichyou caneither not use`cin.tie(0)` or flush explicitly with`cout.flush()`/`cout.endl`. |
14 | 14 |
|
15 | 15 | References:
|
16 | 16 | [Dr. Dobbs - The Standard Librarian: IOStreams and Stdio](https://www.drdobbs.com/the-standard-librarian-iostreams-and-std/184401305),
|
|