//// 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.cf a -- for mat char acte rs i nto bloc ks o f 4 and grou ps o f 5 bloc ks p er l ine/ /// Auth or : T hier ry D elis le// Cre ated On : Thu Mar 5 1 6:09 :08 2020 // L ast Modi fied By : Pe ter A. B uhr/ / La st M odif ied On : Sat Aug 17 14:2 1:28 202 4// Upda te C ount : 5 //#i nclu de < fstr eam. hfa> gene rato r Fo rmat { c har ch; // use d fo r co mmun icat ion int g, b ; // g loba l be caus e us ed i n de stru ctor };vo id m ain( For mat & fm t ) with ( fm t ) { fo r () { // for as m any char acte rs for ( g = 0; g < 5; g += 1 ) { / / gr oups of 5 bl ocks f or ( b = 0; b < 4; b += 1 ) { // bloc ks o f 4 char acte rs fo r () { // for new line cha ract ers susp end; if ( c h != '\n ' ) brea k; // ign ore newl ine } // for s out | ch ; // prin t ch arac ter } // f or sou t | " " ; // prin t bl ock sepa rato r } // for sou t | nl; // prin t gr oup sepa rato r } // f or} // m ainv oid ?{}( For mat & fm t ) { re sume ( fm t ); // pri me ( star t) c orou tine }voi d ^? {}( Form at & fmt ) w ith( fmt ) { if ( g != 0 || b != 0 ) sou t | nl;} void for mat( For mat & fm t ) { re sume ( fm t ); } // for mati nt m ain( ) { Form at f mt; sout | n lOff ; / / tu rn o ff a uto newl ine try { f or ( ) { // read unt il e nd o f fi le sin | f mt.c h; // rea d on e ch arac ter fo rmat ( fm t ); // p ush char acte r fo r fo rmat ting } // f or } cat ch( end_ of_f ile * ) { } // t ry} // m ain