Question about Computers & Internet

1 Answer

Write a program for analyzing which of severaol diff.vowels ,cont

Write a program for analyzing a line of text stored in a file by examining each of the characters and displaying into which of several different categories vowels, constants, digits, white spaces it falls. count of the number of vowels consonants, digits and white space characters, include an appropriate documentation in your program

Posted by on

1 Answer

  • 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
  • 10 Answers

#
# Since no language was specifiec, here's a solution in the
# gawk dialect of awk.
#
# Familiarity with awk is assumed, so only minimal comments
# are present. I have a version with more comments...
#


BEGIN {
IGNORECASE = 1
}

{ r0 = $0 } # Copy the input record into the variable r0, for efficiency

wc += gsub(/[[:blank:]]+/, "", r0) {} # Destructively count all the white spaces in r0

vc += gsub(/[AEIOU]/, "", r0) {} # Destructively count all the vowels in r0

cc += gsub(/[BCDFGHJKLMNPQRSTVWXYZ]/, "", r0) {} # Destructively count all the consonants in r0

END {
printf("%d vowel%s\n", vc, (vc != 1) ? "s" : "")
printf("%d consonant%s\n", cc, (cc != 1) ? "s" : "")
printf("%d white space%s\n", wc, (wc != 1) ? "s" : "")
}

Posted on Jan 02, 2009

  • Galen Tackett Jan 02, 2009

    Sorry, that was all nicely indented until I forgot that all the leading spaces got trimmed off...

  • Galen Tackett Jan 05, 2009

    I will try to post a properly indented version soon...

×

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

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

×

Loading...
Loading...

Related Questions:

1 Answer

May I view corrupt cdr file in win7 ?


make a back up of your corrupt file first if you can
there are many programs out there that can examine the file and is many cases repair it
the work corrupt is often misleading,
the most common faults causing corruption are
1 the file size is incorrectly recorded
2, the actual location of file is incorred
3, the most common, the file dates are incorrect
4, it has been writen on a bad sector of the hard drive or that sector has since been damaged
it is often possible to run scandisk and fix those files , you may have to select "scan surface and attempt to repair files" but that takes a very long time and with today's large drives may take weeks,
backups are a must
there are programs that analyze the files one at a time or at your choosing that can in many instances, repair these files in a much shorter period of time

Mar 29, 2015 | CorelDRAW Graphics Suite X4 for PC...

Tip

Features of Webroot Antivirus software


<p>There are very exciting features available in this program which is very good for security. There is local and online backup available. 1GB storage space available for free and additional storage space is also available on purchase. The files can be analyzed automatically during the installation of this program. The files from desktop, my documents, favourites and my pictures can be used for backup. Its backup solution is robust which can provide security to important files and you can be able to access these files anywhere.<br /> <p> <br> <p>Secure links in emails can be sent to friends and family to share files and there will be no problem about accessing these files. Gamer mode is another nice feature of software which can be turned on with click of button. You can be able to enjoy full screen computer games, videos and presentations with this feature and there will be no interruption. There will be no problems about forgetting toggle to full protection.<br> <p> <br> <p>There is also proactive technology found in this program in order to find malware before any chance of entering into computer. It is very important for the users to have advanced protection because there are many threats which can bypass the traditional signature scanning. The files can be analyzed for malicious behaviour with zero-hour protection of Webroot. The files which are proved to be virus can be blocked and deleted effectively with the help of this program. Spy Sweeper examines files on a computer

on Mar 22, 2011 | Computers & Internet

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 | Computers & Internet

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 | Computers & Internet

2 Answers

How to check the content of two files are same or not


If you want to verify two files are the same, there is a thing called a Checksum. These are used to verify data is copied correctly by identity of a number string. If the number is different on the receiving party then the file was changed either intentionally or accidentally in the process of copying. There are different programs on the internet you could use any one to run a checksum or "hash check" of the file you are comparing..
ChecksumChecksum questioningquestioning

Mar 09, 2010 | Apple OSX 10.3 for Unix, Mac

1 Answer

I need a program in turbo c that would count the vowels in the sentence using for loap


Here's an example:

//This is the array of characters that holds your sentence.
char YourSentance[];

//This is all of the Vowels, note that capitol and lower case are
//considered different.
char Vowels[]={'a','e','i','o','u','A','E','I','O','U'};

//This holds the counter of how many vowels we find
int NumVowels=0;

//Loop through the Sentence using i until we encounter a 0
//which signifies the end of the string
for(int i=0;YourSentance[i]!=0;i++) {
//Now loop through the vowels
for(int x=0;Vowels[x]!=0;x++) {
//Check to see if this character is a vowel
if(YourSentance[i]==Vowels[x]) {
//If it is, increment NumVowels, and end the loop early
NumVowels++;
break; // This line optional
}
}
}

//Now NumVowels contains a count of how many vowels
//we found
printf("There are %i vowels in the sentence.\n",NumVowels);

Feb 29, 2008 | Computers & Internet

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 | Computers & Internet

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 | Computers & Internet

1 Answer

Hi........


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 | Intel (RK80532PG0881M) Pentium 4, 3 GHz...

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 | Computers & Internet

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

149 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...