//// 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 : M on S ep 1 8 11 :35: 57 2 017/ / Up date Cou nt : 31/ /#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 | endl ;}vo id m ain( For mat & fm t ) { fo r ( ;; ) { // f or a s ma ny c hara cter s f or ( fmt .g = 0; fmt. g < 5; f mt.g += 1 ) { / / gr oups of 5 bl ocks f or ( fmt .b = 0; fmt. b < 4; f mt.b += 1 ) { // blo cks of 4 cha ract ers f or ( ;; ) { // for new line cha ract ers susp end( ); i f ( fmt. ch ! = '\ n' ) bre ak; // igno re n ewli ne } // f or so ut | fmt .ch; / / pr int char acte r } // for s out | " "; / / pr int bloc k se para tor } / / fo r s out | en dl; // 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: / /