Find words which contains more than 3 e vowels: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add Snobol) |
Not a robot (talk | contribs) (Add Cowgol) |
||
Line 154: | Line 154: | ||
telemeter |
telemeter |
||
tennessee</pre> |
tennessee</pre> |
||
=={{header|Cowgol}}== |
|||
<lang cowgol>include "cowgol.coh"; |
|||
include "file.coh"; |
|||
interface LineCb(line: [uint8]); |
|||
sub ForEachLine(file: [FCB], cb: LineCb) is |
|||
var buf: uint8[256]; |
|||
var ptr := &buf[0]; |
|||
var length := FCBExt(file); |
|||
while length != 0 loop |
|||
var ch := FCBGetChar(file); |
|||
[ptr] := ch; |
|||
ptr := @next ptr; |
|||
if ch == '\n' then |
|||
[ptr] := 0; |
|||
ptr := &buf[0]; |
|||
cb(&buf[0]); |
|||
end if; |
|||
length := length - 1; |
|||
end loop; |
|||
end sub; |
|||
sub CheckWord implements LineCb is |
|||
var ch := line; |
|||
var e: uint8 := 0; |
|||
loop |
|||
case [ch] is |
|||
when 0: break; |
|||
when 'a': return; |
|||
when 'i': return; |
|||
when 'o': return; |
|||
when 'u': return; |
|||
when 'e': e := e + 1; |
|||
end case; |
|||
ch := @next ch; |
|||
end loop; |
|||
if e > 3 then |
|||
print(line); |
|||
end if; |
|||
end sub; |
|||
var file: FCB; |
|||
if FCBOpenIn(&file, "unixdict.txt") != 0 then |
|||
print("Cannot open unixdict.txt\n"); |
|||
ExitWithError(); |
|||
end if; |
|||
ForEachLine(&file, CheckWord);</lang> |
|||
{{out}} |
|||
<pre>belvedere |
|||
dereference |
|||
elsewhere |
|||
erlenmeyer |
|||
evergreen |
|||
everywhere |
|||
exegete |
|||
freewheel |
|||
nevertheless |
|||
persevere |
|||
preference |
|||
referee |
|||
seventeen |
|||
seventeenth |
|||
telemeter |
|||
tennessee |
|||
</pre> |
|||
=={{header|F_Sharp|F#}}== |
=={{header|F_Sharp|F#}}== |