ostream flag : output manipulator « Development « C++ Tutorial






#include <iostream>
#include <iomanip>
using namespace std;

ostream &ra(ostream &stream)
{
  stream << "-------------- ";
  return stream;
}

// Left Arrow
ostream &la(ostream &stream)
{
  stream << "*************";
  return stream;
}

int main()
{
  cout << ra << 1233.23 << "\n";
  cout << ra << 567.66 << la;

  return 0;
}
-------------- 1233.23
-------------- 567.66*************"








5.10.output manipulator
5.10.1.A simple output manipulator
5.10.2.Create an output manipulator
5.10.3.ostream flag
5.10.4.EndLine manipulator (using escape sequence \n and member function flush)
5.10.5.Create user-defined, nonparameterized stream manipulators: bell manipulator (using escape sequence \a)
5.10.6.Create user-defined, nonparameterized stream manipulators: carriageReturn manipulator (using escape sequence \r)
5.10.7.tab manipulator (using escape sequence \t)
5.10.8.Using the endl stream manipulator.
5.10.9.Create custom ostream operator