//// Cfo rall Ver sion 1.0 .0 C opyr ight (C) 201 7 Un iver sity of Wate rloo //// The con tent s of thi s fi le a re c over ed u nder the lic ence agr eeme nt i n th e// file "LI CENC E" d istr ibut ed w ith Cfor all. //// fmt Line s.cc --/ /// Auth or : P eter A. Buhr // C reat ed O n : Su n Se p 17 21: 56:1 5 20 17// Las t Mo difi ed B y : Pete r A. Buh r// Last Mod ifie d On : T ue D ec 1 1 23 :31: 12 2 018/ / Up date Cou nt : 32/ /#in clud e # incl ude c orou tine For mat { ch ar c h; // used for com muni cati on i nt g , b; / / gl obal bec ause use d in des truc tor} ;voi d ?{ }( F orma t & fmt ) { r esum e( f mt ) ; / / st art coro utin e}vo id ^ ?{}( For mat & fm t ) { if ( fm t.g != 0 || fmt. b != 0 ) sou t | nl;} void mai n( F orma t & fmt ) { for ( ;; ) { // for as many cha ract ers for ( f mt.g = 0 ; fm t.g < 5; fmt .g + = 1 ) { // grou ps o f 5 bloc ks for ( f mt.b = 0 ; fm t.b < 4; fmt .b + = 1 ) { // b lock s of 4 c hara cter s for ( ; ; ) { // f or n ewli ne c hara cter s su spen d(); if ( fm t.ch != '\n' ) b reak ; / / ig nore new line } // for sout | f mt.c h; // prin t ch arac ter } // f or sou t | " " ; // prin t bl ock sepa rato r } // for sou t | nl; // p rint gro up s epar ator } / / fo r} / / ma invo id p rt( Form at & fmt , ch ar c h ) { fmt .ch = ch ; res ume( fmt );} // prti nt m ain( ) { Form at f mt; char ch; for ( ; ; ) { s in | ch; // rea d on e ch arac ter if ( e of( sin ) ) brea k; // eof ? p rt( fmt, ch ); } // for} // main // L ocal Var iabl es: //// tab -wid th: 4 // // c ompi le-c omma nd: "cfa fmt Line s.c" /// / En d: / /