Question: Goal: Your assignment is to write a C++ program to read in a file of English text, and determine the length distribution of words in

 Goal: Your assignment is to write a C++ program to read
in a file of English text, and determine the length distribution of
words in the text as well as count the occurrences of specific
words. This assignment will allow you to practice working with aays. e

Goal: Your assignment is to write a C++ program to read in a file of English text, and determine the length distribution of words in the text as well as count the occurrences of specific words. This assignment will allow you to practice working with aays. e Name:john1_ niv.txt ount of words by length 1 chars 2 chars 3 chars 4 chars 5 chars 6 chars 7 chars 8 chars 9 chars 18 chars 11 chars 12 chars 25 145 341 185 120 61 60 25 28 2.5% 145% 34.1% 18.5% 12.0% 6.1% 6.0% 2.5% 2.8% 6.7% e. 1% 0.1% 0.8% Program Output The text for The Message translation of John 1 was copied into a file called johnI niv.txt." Footnote references were removed. My solution to this assignment was nan using this file. The following screenshot shows what your program should output when this file is specified As you can see it has counted the number of words of each length, up to 12 characters long It also counts the number of words that are over 12 characters long It displays the corresponding percentage to the right of the actual count. 12 chars In addition, it has counted the number of times two groups of specific words occur (God words and article words3), displaying both the counts and percentages ount of God words 12 15 GOO ESUS CHRIST OLY SPIRIT 1.2% 1.5% 0.2% 8.1% e. 3% Implementation using arrays This lab assignment gives you the opportunity to practice using arrays. As you read through the words in the text, you will use one array (an "int" array of 12 elements) to count the number of words of each length, and you will use two sets of parallel amays to count the number of occurrences of specific words. Count of article words e, 6% 8.2% 7.5% THE 75 Functions you need to write 1) A function that takes a string read from the file as a parameter, and retums a new string which contains no characters except letters of the alphabet, and with all letters converted to upper case. NOTE: for this function you will want to use functions defined in . But there is a small wrinkle. The test file was copied from the internet and it contains some 8-bit ASCII characters. If you call functions directly, you will get an assert. You should cast the char value to unsigned char first before passing to the function. Use static cast

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!