Question about Compilers & Programming Tools

1 Answer

Program I want to make a visual basic program that will input a word and determine how many consonants and vowels are present. Can you help me making the program A sample code will mean a lot to me. Thanks and good day.

Posted by on

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Governor:

    An expert whose answer gotĀ voted for 20 times.

    Scholar:

    An expert who has written 20 answers of more than 400 characters.

  • Expert
  • 86 Answers

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.

Posted on Feb 21, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

How do I break the work "exhibition" into syllables?


Have your program split the word into groups of vowels and consonants ie 'exh', 'ib', 'it', 'ion'. For example if the word starts with a vowel, in this case 'e', continue to group it until it reaches the first vowel (i in the 2nd group) after the group of consonants (x and h in the first group), and repeat.

Sep 26, 2014 | Compilers & Programming Tools

1 Answer

How do I divide the word meat into syllables?


Given your list of words, It appears to me that what makes up a syllable is the vowels in the word.. each time 1 or more vowels are separated by 1 or more consonants/symbols, a syllable is born.
so, have an array of characters containing vowels.
now iterate through the given word and create a new syllable(String) by adding the characters you are inspecting until you find a vowel.. now continue to add the vowels you find until you find a consonant/symbol.. that's where your new syllable ends (you can add it to a List if you want or just output it to the command line) ..and if you haven't gone through the entire word yet, create a new syllable(String) and repeat the process.

Good luck

Sep 10, 2014 | Compilers & Programming Tools

1 Answer

What is the advantage of visual basic 6.0?


The advantages of Visual Basic: 1) It's simple language. Things that may be difficult to program with other language can be done in Visual Basic very easily. 2) Because Visual Basic is so popular, There are many good resources (Books, Web sites, News groups and more) that can help you learn the language. You can find the answers to your programming problems much more easily than other programming languages. 3) You can find many tools (Sharewares and Freewares) on the internet that will Spare you some programming time. For example, if you want to ping a user over the internet in your program, Instead of writing the ping function yourself, you can download a control that does it, and use it in your program. Compare to other languages, Visual Basic have the widest variety of tools that you can download on the internet and use in your programs.

Feb 17, 2011 | Microsoft Visual Basic 6.0 for PC

1 Answer

Please teach me how to make a visual basic program.


Microsoft has changed Visual Basic development to it's .NEW platform. Many people still prefer Visual Basic 6.
The best way to get VB6 today is to buy a second hand copy from eBay.

Sep 01, 2010 | Microsoft Compilers & Programming Tools

1 Answer

How to visual basic programing software crack ??????


By make I presume you mean compile, which is available from a menu on the main screen; just look around the middle of the menu bar and check all your options.You should see Compile and Run.

Apr 07, 2009 | Microsoft Visual Basic Enterprise Edition...

1 Answer

How to search strings in visual basic 6.0


example:
Dim SearchWithinThis As String = "ABCDEFGHIJKLMNOP" Dim SearchForThis As String = "DEF" Dim FirstCharacter As Integer = SearchWithinThis.IndexOf(SearchForThis)

Mar 11, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

Help


i did not solve my problem yesterday.
that's why i need your help..
please help me to solve my problem that i posted yesterday.i need your help.
thank you very much.

Feb 21, 2008 | Compilers & Programming Tools

2 Answers

Help me


this the code for your problem. by the way this for vb6.0

Sub CountCharacters(Text As String)
Dim iVowel As Integer
Dim iCons As Integer
Dim iNum As Integer
Dim iSpace As Integer
Dim iOther As Integer

Dim cnt As Integer
Dim sChar As String

For cnt = 1 To Len(Text)
sChar = LCase(Mid(Text, cnt, 1))

Select Case sChar
Case "a", "e", "i", "o", "u" ' And sometimes "y"?
' Vowel
iVowel = iVowel + 1
Case "a" To "z"
' Includes the first case, but VB matches the first case and stops
iCons = iCons + 1
Case "0" To "9"
' Numbers
iNum = iNum + 1
Case " ", vbTab, vbLf
' Space characters
' Not including vbCr as this will likely be dealing with Windows text
' and I only want to match one character for a newline
iSpace = iSpace + 1
Case Else
If sChar <> vbCr Then iOther = iOther + 1
End Select
Next cnt

Debug.Print "Text: " & Text
Debug.Print "Vowels: " & CStr(iVowel)
Debug.Print "Consonants: " & CStr(iCons)
Debug.Print "Numbers: " & CStr(iNum)
Debug.Print "Space characters: " & CStr(iSpace)
Debug.Print "Other: " & CStr(iOther)
End Sub

Feb 21, 2008 | Compilers & Programming Tools

1 Answer

Help me


Sub CountCharacters(Text As String)
Dim iVowel As Integer
Dim iCons As Integer
Dim iNum As Integer
Dim iSpace As Integer
Dim iOther As Integer

Dim cnt As Integer
Dim sChar As String

For cnt = 1 To Len(Text)
sChar = LCase(Mid(Text, cnt, 1))

Select Case sChar
Case "a", "e", "i", "o", "u" ' And sometimes "y"?
' Vowel
iVowel = iVowel + 1
Case "a" To "z"
' Includes the first case, but VB matches the first case and stops
iCons = iCons + 1
Case "0" To "9"
' Numbers
iNum = iNum + 1
Case " ", vbTab, vbLf
' Space characters
' Not including vbCr as this will likely be dealing with Windows text
' and I only want to match one character for a newline
iSpace = iSpace + 1
Case Else
If sChar <> vbCr Then iOther = iOther + 1
End Select
Next cnt

Debug.Print "Text: " & Text
Debug.Print "Vowels: " & CStr(iVowel)
Debug.Print "Consonants: " & CStr(iCons)
Debug.Print "Numbers: " & CStr(iNum)
Debug.Print "Space characters: " & CStr(iSpace)
Debug.Print "Other: " & CStr(iOther)
End Sub

Feb 21, 2008 | Compilers & Programming Tools

2 Answers

Visual basic code


'Text1 is a textbox or a string you can use

Private Sub Command1_Click()
Dim a
Dim vow, con As Integer
vow = 0
con = 0
For i = 1 To Len(Text1)
a = Mid(Text1, i, 1)
If (a = "a" Or a = "e" Or a = "i" Or a = "o" Or a = "u") Then
vow = vow + 1
Else
con = con + 1
End If
Next
MsgBox "Vowels: " & vow & vbNewLine & "Consonants : " & con

End Sub

Feb 19, 2008 | Compilers & Programming Tools

Not finding what you are looking for?
Compilers & Programming Tools Logo

Related Topics:

339 people viewed this question

Ask a Question

Usually answered in minutes!

Top Compilers & Programming Tools Experts

Robin Hill
Robin Hill

Level 3 Expert

1251 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18298 Answers

Florin

Level 3 Expert

733 Answers

Are you a Compiler and Programming Tool Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...