2. Using the algorithm developed above, create a function that determines the status of the first character of a word. The function should receive a string containing a single word as the first parameter which should be defined as constant, and integer reference parameters containing the counts for the number of vowels, consonants and numbers found in a sentence. The main function should open a file containing sentences, read each sentence, and use the function to add to the counts for each word of the sentence. The main function should output each sentence read from the file and the total counts for each sentence. Hints: Each sentence from the file must be parsed into individual words which the function can examine. You may assume words will be separated by a single space.The find and substr string methods can assist in the parsing of the sentence. Alternatively, you may use a stringstream object to parse each line read from the file. See Strings.cpp and StringStream.cpp examples. Please see http://www.cplusplus.com/reference/string/string/e to learn more about using the find and substr functions and http://www.cplusplus.com/reference/sstream/istringstream/str/ e to learn about the istringstream class. The text input can be created with any simple text editor such as NotePad. InjGrasp, text files can be created be selecting New | Plain Text from the File menu. Store the text file in the same folder as the program. Example run: Input string: There are 3 cats in the yard! 2 words begin with a vowel 4 words begin with a consonant 1 other 'words' were found Input string: Fall is a beautiful time of year. 3 words begin with a vowel 4 words begin with a consonant O other 'words' were found Input string: There are 12 inches in a foot. 4 words begin with a 2 words begin with a consonant 1 other 'words' were found vowel

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Please use easy logic with proper indentations and comments for understanding!. Coding should be in C++. I am providing an algorithm that you will need to answer this coding question. I am also providing this solved program but it's not printing each line separately as it supposed to (Output given). The file has 3 separate lines. Our program supposed to print three separate lines as exactly shown in the sample output. Please review my code and provide a correction to it. Thank you

 

2. Using the algorithm developed above, create a function that determines the status of the first character of a
word. The function should receive a string containing a single word as the first parameter which should be
defined as constant, and integer reference parameters containing the counts for the number of vowels,
consonants and numbers found in a sentence. The main function should open a file containing sentences, read
each sentence, and use the function to add to the counts for each word of the sentence. The main function
should output each sentence read from the file and the total counts for each sentence.
Hints: Each sentence from the file must be parsed into individual words which the function can examine. You may
assume words will be separated by a single space.The find and substr string methods can assist in the parsing of
the sentence. Alternatively, you may use a stringstream object to parse each line read from the file. See
Strings.cpp and StringStream.cpp examples. Please see http://www.cplusplus.com/reference/string/string/e to
learn more about using the find and substr functions
and http://www.cplusplus.com/reference/sstream/istringstream/str/ e to learn about the istringstream class.
The text input can be created with any simple text editor such as NotePad. InjGrasp, text files can be created be
selecting New | Plain Text from the File menu. Store the text file in the same folder as the program.
Example run:
Input string: There are 3 cats in the yard!
2 words begin with a vowel
4 words begin with a consonant
1 other 'words' were found
Input string: Fall is a beautiful time of year.
3 words begin with a vowel
4 words begin with a consonant
O other 'words' were found
Input string: There are 12 inches in a foot.
4 words begin with a
2 words begin with a consonant
1 other 'words' were found
vowel
Transcribed Image Text:2. Using the algorithm developed above, create a function that determines the status of the first character of a word. The function should receive a string containing a single word as the first parameter which should be defined as constant, and integer reference parameters containing the counts for the number of vowels, consonants and numbers found in a sentence. The main function should open a file containing sentences, read each sentence, and use the function to add to the counts for each word of the sentence. The main function should output each sentence read from the file and the total counts for each sentence. Hints: Each sentence from the file must be parsed into individual words which the function can examine. You may assume words will be separated by a single space.The find and substr string methods can assist in the parsing of the sentence. Alternatively, you may use a stringstream object to parse each line read from the file. See Strings.cpp and StringStream.cpp examples. Please see http://www.cplusplus.com/reference/string/string/e to learn more about using the find and substr functions and http://www.cplusplus.com/reference/sstream/istringstream/str/ e to learn about the istringstream class. The text input can be created with any simple text editor such as NotePad. InjGrasp, text files can be created be selecting New | Plain Text from the File menu. Store the text file in the same folder as the program. Example run: Input string: There are 3 cats in the yard! 2 words begin with a vowel 4 words begin with a consonant 1 other 'words' were found Input string: Fall is a beautiful time of year. 3 words begin with a vowel 4 words begin with a consonant O other 'words' were found Input string: There are 12 inches in a foot. 4 words begin with a 2 words begin with a consonant 1 other 'words' were found vowel
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Algebraic Expressions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education