Kernighans large earthquake problem: Difference between revisions

Content added Content deleted
(Added XPL0 example.)
Line 1,802: Line 1,802:


=={{header|XPL0}}==
=={{header|XPL0}}==
Usage: quake <data.txt
\Usage: quake <data.txt
<lang XPL0>int C;
<lang XPL0>int C;
[loop [OpenO(8); \get line from input file
[loop [OpenO(8); \get line from input file
Line 1,810: Line 1,810:
until C = $0A\LF\;
until C = $0A\LF\;
OpenI(8);
OpenI(8);
repeat C:= ChIn(8); \skip to whitespace
repeat until ChIn(8) <= $20\space\;
until C <= $20\space\;
repeat until ChIn(8) > $20\space\;
repeat C:= ChIn(8); \skip whitespace
repeat until ChIn(8) <= $20\space\;
until C > $20\space\;
repeat C:= ChIn(8); \skip to whitespace
until C <= $20\space\;
if RlIn(8) > 6.0 then
if RlIn(8) > 6.0 then
[OpenI(8); \output saved line to console
[OpenI(8); \output saved line to console