![[Dept of Engineering]](http://www.eng.cam.ac.uk/images/house_style/engban-s.gif)
Next: Input of User-Defined types
Up: Input/Output
Previous: Stream Iterators
One way to do this is by overloading the stream insertion operator. The
following defines how complex numbers should be printed out -
ostream& operator<<(ostream&s, complex z) // returns ostream& so can be chained
{
return s << '(' << z.real() << ',' << z.imag() << ')';
}
Tim Love
2001-07-05