Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

While all the original applications for computers back in the 1950's and many, if not most, applications today are mathematical, there is a large field

image text in transcribed

While all the original applications for computers back in the 1950's and many, if not most, applications today are mathematical, there is a large field of computing that deals with text processing. These range from editing and word processing systems to typesetting to literary analysis. Having some exposure to this type of problems, and some experience in solving them, is invaluable in preparation for a career in software development. Develop a C++ program to catalog certain facts about the contents of a text file, including the longest and shortest words, total number of words, and the number of times each word in a selected group occurs within the file. Declare the following data storage variables: An array of 100 strings to hold the selected words, A parallel array of whole number values for word counts A parallel array of floating point values for word frequencies. Two strings to hold the shortest and longest words in the data file. An array hold the number of letters (example A: 456, B: 5678, etc) Assume lowercase arid uppercase letters as the same a == A. An value to hold the number of non letter chars (:,."/[etc Do not include white spaces. Keep all the non letter chars in one group (example Non-Letter chars: 4567) The number of "numbers" in the file (example, Numbers: 45). Again, all numbers are in one group The number of vowels (a, e, i, o, u) and the number of consonants. The number of words The number of total chars The average word length Read the words from a file named "SelectWords.txt" into the array of 100 strings. Open and read one of the two data files. Examine each word as it is read as follows: Increment the Total Word Count by one for each word read from the data file. Remove leading and trailing punctuation. Continue with this word only if its length is still greater than zero. Convert the remaining characters in the word to lower-case. If the word is shorter than the word currently in the Shortest Word string, replace the contents of that string with the word from the data file. If the word is longer than the word currently in the Longest Word string, replace the contents of that string with the word from the data file. If the word matches one in the Select Words array, increment the corresponding occurrence count in the parallel array of whole numbers. After all words have been read from the data file, calculate the frequency of occurrence of each of the Selected Word's by dividing its occurrence count by the Total Word Count, and save the calculated value in the corresponding element of the floating point array. Display the name of the data file, the shortest word, longest word, and total word count

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago

Question

Define Decision making

Answered: 1 week ago

Question

What are the major social responsibilities of business managers ?

Answered: 1 week ago

Question

What are the skills of management ?

Answered: 1 week ago