Question about Compilers & Programming Tools

2 Answers

Visual basic code

I want to make a program that will input a word and determine how many vowels or consonants are there in the inputted word. Can you help me make my code?

Posted by on

  • menjo Feb 19, 2008

    I'm also needing a Java program. Please help me asap

  • menjo Feb 19, 2008

    I'm also needing a Java program. Please help me asap

×

2 Answers

Thanks for helping me. I really appreciate it. I probably rate it as 100% resourceful. Thanks for helping me.

May ask again a new solution for a system made of Java programming language.

Posted on Feb 21, 2008

  • 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.

    Hot-Shot:

    An expert who has answered 20 questions.

  • Expert
  • 62 Answers

'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

Posted on Feb 19, 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

Write a computer program to change fahrenheit to centigrade


'Convert fahrenheit to centigrade
dim cent as int
cent = Val(Text1.Text) // Text1.text as your input
cent = cent - 32
cent = cent * 0.5556
Text1.Text = cent // Converted and changed the same textbox

Feb 21, 2014 | Microsoft Visual Basic 6.0 for PC

1 Answer

Where can i find an example program of visual basic that can input an odd and even number and can display the result of highest even and highest odd number and can sort them from minimum to maximum


http://www.microsoft.com/visualstudio/en-us/products/teamsystem/default.mspx?pt_id=-1&WT.mc_id=B66C779D-0907-4EE1-9435-FED85F10C8E2&WT.srch=1&wt.mc_id=vspdsrch
this site has a free sample download

Apr 16, 2009 | Microsoft Visual Basic Professional...

1 Answer

Microsoft Access query in VB


first you need to create a record set to do this, after creating a record set RS1. please follow the code below:
Update the code as per your requirement.
Rs1.Open "Select * from table_name where UserName = '" & UName & "'", Cn1, adOpenDynamic, adLockOptimistic

Mar 14, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

With spaces and exclude spaces


Use the Len function
number_or_characters = Len(your_input_string)

Taking input from a TextBox is easy:
number_or_characters = Len(txtInput.Text)

Mar 04, 2009 | Microsoft Visual Basic 6.0 for PC

1 Answer

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.

Feb 21, 2008 | Compilers & Programming Tools

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

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

Related Topics:

209 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

Fred Block
Fred Block

Level 2 Expert

289 Answers

Les Dickinson
Les Dickinson

Level 3 Expert

18299 Answers

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

Answer questions

Manuals & User Guides

Loading...