Question about Compilers & Programming Tools

2 Answers

Visual basic 6.0

Can you send me a code to my program..
this is my problem:
"enter a sentence and determine the number of words present in a particular sentence."
thank you..i hope you can send me the code i need,
thank you...god bless,,,,,,,,

Posted by on

  • K-ann Feb 29, 2008

    Good morning!

    can you send me a code in visual basic 6.0 ?

    this is my program:

    " enter a sentence and determine how many word are there in a particular sentence"

    Thank you very much. Hope that you can send me a code in my problem

    God bless you........

×

2 Answers

  • Level 1:

    An expert who has achieved level 1.

    Corporal:

    An expert that has over 10 points.

    Problem Solver:

    An expert who has answered 5 questions.

  • Contributor
  • 11 Answers

Below is the code....you can skip the isWord check if you want to count numbers as well. Hope this helps...


Function countWords(str As String) As Long
Dim words() As String, i As Long, numWords As Long
words = Split(str, " ")
For i = LBound(words) To UBound(words)
If isWord(words(i)) Then
numWords = numWords + 1
End If
Next
countWords = numWords
End Function
Function isWord(str As String) As Boolean
Dim ret As Boolean
If str = Null Then
ret = False
ElseIf Len(str) = 0 Then
ret = False
ElseIf Mid(str, 1, 1) >= "A" And Mid(str, 1, 1) <= "Z" Then
ret = True
ElseIf Mid(str, 1, 1) >= "a" And Mid(str, 1, 1) <= "z" Then
ret = True
Else
ret = False
End If
isWord = ret
End Function

Posted on Mar 19, 2008

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that got 5 achievements.

    Sergeant:

    An expert that has over 500 points.

    Champion:

    An expert who has answered 200 questions.

  • Expert
  • 326 Answers

Use a compare (instr) command to search the sentence for punctution and spaces. Increment a variable for each word found, resetting the search string and retaining the start position of each find.

Posted on Feb 27, 2008

Add Your Answer

Uploading: 0%

my-video-file.mp4

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

×

Loading...
Loading...

Related Questions:

1 Answer

We want to make mini project in vb and we want that it is a veriety and useful and also in less expence


try to this topic. HOW TO CONVERT NUMBERS INTO WORDS. you can search though internet the free program for converting numbers into words.

Dec 23, 2010 | Microsoft Visual Basic 6.0 for PC

1 Answer

Visual basic 6.0


I am sorry but due to your EULA we cannot provide you with a key for this software. You must contact the publisher for a legally obtained key. FixYa TOS does not allow for us to assist with copies of keys, codes, ids, or software as it is against the law.

Software Counterfeiting
This type of piracy is the illegal duplication and sale of copyrighted material with the intent to directly imitate the copyrighted product. In the case of packaged software, counterfeit versions often include copies of CDs or diskettes containing the software programs, as well as related packaging, manuals, license agreements, labels, registration cards, and security features.

Software Piracy is stealing. If you or your company were caught pirating software, you could be held liable under both civil and criminal law. If a copyright owner brings a civil action against you, the penalties in the U.S. may be up to $150,000 for each program copied. The U.S. government can also criminally prosecute you. If you are convicted, you can be fined up to $250,000, sentenced to jail for up to five years, or both.

Jan 14, 2010 | Microsoft Visual Basic 6.0 for PC

1 Answer

I open a link with word document and I get code execution has been interrupted, and it asks me if I want to debug, stop, clear, and click next on the pop up display.


If this occurs in specific link, the problem must be parametric. Or if it appears in all the link, you should reinstall the word document again and if the problem does not resolve, remove Microsoft Visual Basic Enterprise completely and then check. If it is opening correctly, then reinstall Microsoft Visual Basic Enterprise. If problem appreas again, there must be something fishy in your Visual Basic disk.

Nov 18, 2009 | Microsoft Visual Basic Enterprise Edition...

3 Answers

Product id of visual studio 6 enterprise edition


Hi,

you can use dummy product id:
112-11111 (second box as many 1's as can)

Thanks.

Mar 17, 2009 | Microsoft Mlf Visual Studio Enterprise...

2 Answers

Source code for word count


Haha, i wrote one of thee a while ago for a competition. You need to us e the char at function mate :D
Inside a for loop
Ill havea look for you though :D

Sep 09, 2008 | ArcMedia JavaScript Source Code 3000 Pro...

1 Answer

Program


Sub aa()
'
' aa Macro
'
'
Dim a As String
a = "how are you this is dharani"
Dim leng, cnt As Integer
leng = 1
cnt = 0
While leng <= Len(RTrim(a))
If Mid(a, leng, 1) = " " Then
cnt = cnt + 1
End If
leng = leng + 1
Wend
If Len(RTrim(a)) > 0 Then
cnt = cnt + 1
End If
MsgBox Str(cnt) + " Words"
End Sub

Feb 27, 2008 | Compilers & Programming Tools

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 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:

375 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

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