//// 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 -- form at c hara cter s in to b lock s of 4 a nd g roup s of 5 b lock s pe r li ne// // A utho r : Pe ter A. B uhr/ / Cr eate d On : Sun Sep 17 21:5 6:15 201 7// Last Mod ifie d By : P eter A. Buhr // L ast Modi fied On : Sa t Au g 17 14: 26:0 3 20 24// Upd ate Coun t : 60// #inc lude #i nclu de < coro utin e.hf a>co rout ine Form at { cha r ch ; // u sed for comm unic atio n in t g, b; // glo bal beca use used in dest ruct or}; void mai n( F orma t & fmt ) wi th( fmt ) { for () { / / fo r as man y ch arac ters fo r ( g = 0; g < 5 ; g += 1 ) { // grou ps o f 5 bloc ks for ( b = 0 ; b < 4; b + = 1 ) { / / bl ocks of 4 ch arac ters for () { // f or n ewli ne c hara cter s su spen d; if ( ch != ' \n' ) br eak; // i gnor e ne wlin e } / / fo r sou t | ch; / / pr int char acte r } // for s out | " "; / / pr int bloc k se para tor } / / fo r s out | nl ; / / pr int grou p se para tor } // for } // mai nvoi d ?{ }( F orma t & fmt ) { resu me( fmt ); // p rime (st art) cor outi ne}v oid ^?{} ( Fo rmat & f mt ) wit h( f mt ) { i f ( g != 0 | | b != 0 ) s out | nl ;}vo id f orma t( F orma t & fmt ) { resu me( fmt );} // f orma tint mai n() { Fo rmat fmt ; so ut | nlO ff; // turn off aut o ne wlin e tr y { for () { / / re ad u ntil end of file s in | fmt .ch; // r ead one char acte r form at( fmt ); // pus h ch arac ter for form atti ng } // for } c atch ( en d_of _fil e * ) { } // try } // mai n