Find words which contains all the vowels: Difference between revisions
Content added Content deleted
m (what the...) |
Not a robot (talk | contribs) (Add Modula-2) |
||
Line 821: | Line 821: | ||
{{out}} |
{{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>{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> |
||
=={{header|Modula-2}}== |
|||
<lang modula2>MODULE Vowels; |
|||
IMPORT SeqIO; |
|||
IMPORT Texts; |
|||
FROM InOut IMPORT WriteString, WriteLn; |
|||
FROM Strings IMPORT Length; |
|||
VAR file: SeqIO.FILE; |
|||
dict: Texts.TEXT; |
|||
word: ARRAY [0..63] OF CHAR; |
|||
fs: SeqIO.FileState; |
|||
ts: Texts.TextState; |
|||
PROCEDURE HasAllVowels(word: ARRAY OF CHAR): BOOLEAN; |
|||
VAR a, e, i, o, u, pos: CARDINAL; |
|||
ch: CHAR; |
|||
BEGIN |
|||
a := 0; e := 0; i := 0; o := 0; u := 0; |
|||
FOR pos := 0 TO Length(word)-1 DO |
|||
ch := word[pos]; |
|||
IF ch = 'a' THEN INC(a); |
|||
ELSIF ch = 'e' THEN INC(e); |
|||
ELSIF ch = 'i' THEN INC(i); |
|||
ELSIF ch = 'o' THEN INC(o); |
|||
ELSIF ch = 'u' THEN INC(u); |
|||
END; |
|||
IF (a>1) OR (e>1) OR (i>1) OR (o>1) OR (u>1) THEN |
|||
RETURN FALSE; |
|||
END; |
|||
END; |
|||
RETURN (a=1) AND (e=1) AND (i=1) AND (o=1) AND (u=1); |
|||
END HasAllVowels; |
|||
BEGIN |
|||
fs := SeqIO.Open(file, "unixdict.txt"); |
|||
ts := Texts.Connect(dict, file); |
|||
WHILE NOT Texts.EOT(dict) DO |
|||
Texts.ReadLn(dict, word); |
|||
IF (Length(word) > 10) AND HasAllVowels(word) THEN |
|||
WriteString(word); |
|||
WriteLn(); |
|||
END; |
|||
END; |
|||
ts := Texts.Disconnect(dict); |
|||
fs := SeqIO.Close(file); |
|||
END Vowels.</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> |
|||
=={{header|Nim}}== |
=={{header|Nim}}== |