|
|
1.1 root 1: // exios203.cpp
2: // 2-argument manipulator example
3: #include <iostream.h>
4: #include <iomanip.h>
5:
6: struct fillpair {
7: char ch;
8: int cch;
9: };
10:
11: IOMANIPdeclare( fillpair );
12:
13: ostream& fp( ostream& os, fillpair pair )
14: {
15: for ( int c = 0; c < pair.cch; c++ ) {
16: os << pair.ch;
17: }
18: return os;
19: }
20:
21: OMANIP(fillpair) fill( char ch, int cch )
22: {
23: fillpair pair;
24:
25: pair.cch = cch;
26: pair.ch = ch;
27: return OMANIP (fillpair)( fp, pair );
28: }
29:
30:
31: void main()
32: {
33: cout << "10 dots coming" << fill( '.', 10 ) << "done" << endl;
34: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.