Program
I wrote this as a vbscript. It's Visual Basic code in windows script.
If you have XP, just copy the text into notepad and save it as
"vowel.vbs". Now double click the newly created script file.
' vowel.vbs
'
' This VBScript is used to count the vowels and consonants in a string.
' Designed and Tested on Windows XP Pro SP2
'
' Version 1.0.0 - 02.20.2008
'
' This code may be freely distributed or modified.
' -----------------------------------------------------------------'
Option Explicit
Dim str
Dim vowels
Dim consonants
Dim i
vowels = 0
consonants = 0
str = "hello"
for i = 1 to len(str)
select case mid(str,i,1)
case "a"
vowels = vowels + 1
case "e"
vowels = vowels + 1
case "i"
vowels = vowels + 1
case "o"
vowels = vowels + 1
case "u"
vowels = vowels + 1
case else
consonants = consonants + 1
end select
next
msgbox "Vowels = " & vowels
msgbox "Consonants = " & consonants
'End of script.
×