Find words which contains all the vowels: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add CLU) |
(Added XPL0 example.) |
||
Line 1,805: | Line 1,805: | ||
24: stupefaction |
24: stupefaction |
||
25: sulfonamide |
25: sulfonamide |
||
</pre> |
|||
=={{header|XPL0}}== |
|||
<lang XPL0>string 0; \Use zero-terminated strings |
|||
int I, Ch, Len; |
|||
char Word(100); \(longest word in unixdict.txt is 22 chars) |
|||
def LF=$0A, CR=$0D, EOF=$1A; |
|||
func AllVowels; \Return 'true' if Word contains all vowels once |
|||
int Cnt, I; |
|||
[Cnt:= 0; |
|||
for I:= 0 to Len-1 do |
|||
case Word(I) of |
|||
^a: Cnt:= Cnt + $00001; |
|||
^e: Cnt:= Cnt + $00010; |
|||
^i: Cnt:= Cnt + $00100; |
|||
^o: Cnt:= Cnt + $01000; |
|||
^u: Cnt:= Cnt + $10000 |
|||
other []; |
|||
return Cnt = $11111; |
|||
]; |
|||
[FSet(FOpen("unixdict.txt", 0), ^I); \open dictionary and set it to device 3 |
|||
OpenI(3); |
|||
repeat I:= 0; |
|||
loop [repeat Ch:= ChIn(3) until Ch # CR; \remove possible CR |
|||
if Ch=LF or Ch=EOF then quit; |
|||
Word(I):= Ch; |
|||
I:= I+1; |
|||
]; |
|||
Word(I):= 0; \terminate string |
|||
Len:= I; |
|||
if Len > 10 then |
|||
if AllVowels then [Text(0, Word); CrLf(0)]; |
|||
until Ch = EOF; |
|||
]</lang> |
|||
{{out}} |
|||
<pre> |
|||
ambidextrous |
|||
bimolecular |
|||
cauliflower |
|||
communicable |
|||
communicate |
|||
consanguine |
|||
consultative |
|||
countervail |
|||
exclusionary |
|||
grandiloquent |
|||
importunate |
|||
incommutable |
|||
incomputable |
|||
insupportable |
|||
loudspeaking |
|||
malnourished |
|||
mensuration |
|||
oneupmanship |
|||
pandemonium |
|||
permutation |
|||
perturbation |
|||
portraiture |
|||
praseodymium |
|||
stupefaction |
|||
sulfonamide |
|||
</pre> |
</pre> |