endl=\n+flush 肯定是没错的,因为C++标准中就是这些写的
ISO/IEC 14882:2003(E)第27.6.2.7章节:
namespace std {
template <class charT, class traits>
basic_ostream<charT,traits>& endl(basic_ostream<charT,traits>&os);
}
Effects: Callsos.put(os.widen('\n') ), then os.flush().
Returns: os.
The effect of executingcout << endl is to insert a newline character in the output sequence controlled by cout, then synchronize it with any external file with which it might be associated.