共用方式為


endl

Terminates a line and flushes the buffer.

template class<_Elem, _Tr>
   basic_ostream<_Elem, _Tr>& endl( 
      basic_ostream<_Elem, _Tr>& _Ostr 
   );

Parameters

  • _Elem
    The element type.

  • _Ostr
    An object of type basic_ostream.

  • _Tr
    Character traits.

Return Value

An object of type basic_ostream.

Remarks

The manipulator calls _Ostr**.put(_Ostr.** widen('\n')), and then calls _Ostr**.**flush. It returns _Ostr.

Example

// ostream_endl.cpp
// compile with: /EHsc
#include <iostream>

int main( ) 
{
   using namespace std;
   cout << "testing" << endl;
}
testing

Requirements

Header: <ostream>

Namespace: std

See Also

Reference

iostream Programming

iostreams Conventions