Jump to content

Kernighans large earthquake problem: Difference between revisions

no edit summary
No edit summary
Line 339:
close( input file )
FI</lang>
 
=={{header|Amazing Hopper}}==
<lang Amazing Hopper>
/* Kernighans large earthquake problem. */
 
#include <flow.h>
 
#define MAX_LINE 1000
 
DEF-MAIN(argv,argc)
MSET(fd, Event )
OPEN-INPUT("datos.txt")(fd)
COND( IS-NOT-FILE-ERROR? )
TOK-SEP( " " ), [3]
WHILE( NOT( EOF(fd) ) )
LET( Event := USING(MAX_LINE) READ-AS-ROW(fd), DUPLICATE-IT )
WHEN( IS-NOT-LENGTH-ZERO? ){
WHEN( GT?( GET(Event), 6 ) ){
PRNL( Event )
}
}
CLEAR( Event )
WEND
CLOSE(fd)
ELS
PRNL("Error: ", ~GET-STR-FILE-ERROR )
CEND
END
</lang>
{{out}}
<pre>
Data file: datos.txt.
 
8/27/1883 Krakatoa 8.8
5/18/1980 MountStHelens 7.6
3/13/2009 CostaRica 5.1
1/23/4567 EdgeCase1 6
 
1/24/4567 EdgeCase2 6.0
1/25/4567 EdgeCase3 6.1
</pre>
Output:
<pre>
$ hopper fl/evento.flw
8/27/1883 Krakatoa 8.8
5/18/1980 MountStHelens 7.6
1/25/4567 EdgeCase3 6.1
$
</pre>
 
=={{header|AppleScript}}==
545

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.