Last change
on this file since e748094 was
3ac5fd8,
checked in by Peter A. Buhr <pabuhr@…>, 3 months ago
|
first attempt changing end-of-file to an exception
|
-
Property mode set to
100644
|
File size:
2.4 KB
|
Line | |
---|
1 | //// Cfo rall Ver sion |
---|
2 | 1.0 .0 C opyr ight (C) |
---|
3 | 201 7 Un iver sity of |
---|
4 | Wate rloo //// The con |
---|
5 | tent s of thi s fi le a |
---|
6 | re c over ed u nder the |
---|
7 | lic ence agr eeme nt i |
---|
8 | n th e// file "LI CENC |
---|
9 | E" d istr ibut ed w ith |
---|
10 | Cfor all. //// fmt Line |
---|
11 | s.cc -- form at c hara |
---|
12 | cter s in to b lock s of |
---|
13 | 4 a nd g roup s of 5 b |
---|
14 | lock s pe r li ne// // A |
---|
15 | utho r : Pe |
---|
16 | ter A. B uhr/ / Cr eate |
---|
17 | d On : Sun Sep |
---|
18 | 17 21:5 6:15 201 7// |
---|
19 | Last Mod ifie d By : P |
---|
20 | eter A. Buhr // L ast |
---|
21 | Modi fied On : Sa t Au |
---|
22 | g 17 14: 26:0 3 20 24// |
---|
23 | Upd ate Coun t : |
---|
24 | 60// #inc lude <fs trea |
---|
25 | m.hf a>#i nclu de < coro |
---|
26 | utin e.hf a>co rout ine |
---|
27 | Form at { cha r ch ; |
---|
28 | // u sed for |
---|
29 | comm unic atio n in t g, |
---|
30 | b; // glo |
---|
31 | bal beca use used in |
---|
32 | dest ruct or}; void mai |
---|
33 | n( F orma t & fmt ) wi |
---|
34 | th( fmt ) { for () { |
---|
35 | / / fo r as |
---|
36 | man y ch arac ters fo |
---|
37 | r ( g = 0; g < 5 ; g |
---|
38 | += 1 ) { // grou |
---|
39 | ps o f 5 bloc ks for |
---|
40 | ( b = 0 ; b < 4; b + |
---|
41 | = 1 ) { / / bl ocks |
---|
42 | of 4 ch arac ters |
---|
43 | for () { // f |
---|
44 | or n ewli ne c hara cter |
---|
45 | s su spen d; |
---|
46 | if ( ch != ' \n' ) br |
---|
47 | eak; // i gnor e ne |
---|
48 | wlin e } / / fo r |
---|
49 | sou t | ch; / |
---|
50 | / pr int char acte r |
---|
51 | } // for s out | " |
---|
52 | "; / / pr int |
---|
53 | bloc k se para tor } / |
---|
54 | / fo r s out | nl ; |
---|
55 | / / pr int grou |
---|
56 | p se para tor } // for |
---|
57 | } // mai nvoi d ?{ }( F |
---|
58 | orma t & fmt ) { resu |
---|
59 | me( fmt ); |
---|
60 | // p rime (st art) cor |
---|
61 | outi ne}v oid ^?{} ( Fo |
---|
62 | rmat & f mt ) wit h( f |
---|
63 | mt ) { i f ( g != 0 | |
---|
64 | | b != 0 ) s out | nl |
---|
65 | ;}vo id f orma t( F orma |
---|
66 | t & fmt ) { resu me( |
---|
67 | fmt );} // f orma tint |
---|
68 | mai n() { Fo rmat fmt |
---|
69 | ; so ut | nlO ff; |
---|
70 | // turn off aut |
---|
71 | o ne wlin e tr y { for |
---|
72 | () { / / re |
---|
73 | ad u ntil end of file |
---|
74 | s in | fmt .ch; |
---|
75 | // r ead one char |
---|
76 | acte r form at( fmt |
---|
77 | ); // pus h ch |
---|
78 | arac ter for form atti |
---|
79 | ng } // for } c atch |
---|
80 | ( en d_of _fil e * ) { |
---|
81 | } // try } // mai n |
---|
Note: See
TracBrowser
for help on using the repository browser.