1 2 3 4 5 6 7 8 9

*

In an interactive application we often send information to the screen, or make requests and expect the user to respond to them, in this case the ostream needs to be flushed before each input operation
The
tie()function is used to tie together an input and an output stream. The tie() function is called on an istream, and it's parameter is the ostream that is to be flushed before each input operation
The following call is automatically made for us:

*

*

cin.tie(&cout)

*

*

The width of an output field can be controlled by calling the width()function. The parameter to this call is the minimum width of the output field The next output operation that requires formatting will produce an output field of at least this width. If the value needs more characters the field will be wider, otherwise it will be padded with a fill character The fill character is specified using the fill()procedure. The parameter to this procedure is a char giving the character to be used for padding. By default this character is the blank

*

cout << width(5) << i << width(4) << j << flush;

23 March, 1998

Page 5