Anonymous user
Count how many vowels and consonants occur in a string: Difference between revisions
Count how many vowels and consonants occur in a string (view source)
Revision as of 15:57, 20 November 2021
, 2 years agoAdded solution for Action!
No edit summary |
(Added solution for Action!) |
||
Line 7:
<br><br>
=={{header|Action!}}==
<lang Action!>PROC CountVovelsConsonants(CHAR ARRAY s BYTE POINTER vov,con)
BYTE i
CHAR c
vov^=0 con^=0
FOR i=1 TO s(0)
DO
c=s(i)
IF c>='A AND c<='Z THEN
c==+'a-'A
FI
IF c>='a AND c<='z THEN
IF c='a OR c='e OR c='i OR c='o OR c='u THEN
vov^==+1
ELSE
con^==+1
FI
FI
OD
RETURN
PROC Test(CHAR ARRAY s)
BYTE vov,con
PrintE("Input string:")
PrintE(s)
CountVovelsConsonants(s,@vov,@con)
PrintF("Vovel count=%I, consonant count=%I%E%E",vov,con)
RETURN
PROC Main()
Test("Now is the time for all good men to come to the aid of their country.")
Test("Forever Action! programming language")
RETURN</lang>
{{out}}
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Count_how_many_vowels_and_consonants_occur_in_a_string.png Screenshot from Atari 8-bit computer]
<pre>
Input string:
Now is the time for all good men to come to the aid of their country.
Vovel count=22, consonant count=31
Input string:
Forever Action! programming language
Vovel count=13, consonant count=19
</pre>
=={{header|Ada}}==
|