Question: Hello, I need help with the following assignment: C++ code. Input file #1, words.txt contains a list of words for which well be accumulating counts.

Hello, I need help with the following assignment:

C++ code.

Input file #1, words.txt contains a list of words for which well be accumulating counts.

Step 1 Read this list of words into an array.

Step 2 Write a function which will accept this array, its count and a single word as parameters. The function should sequentially compare the single word to each item in the array, and return the index position in the array where the word is found or -1 if not found.

Step 3 Declare an array of integers to keep track of word counts. Input file #2, text.txt contains another list of words (the first paragraph of Moby Dick) one word per line.

Step 4 Write a loop to read the second input file. For each word, call the function from step 2 to get the index position of the word in the master list. Increase the count for that word, i.e. the number of times that word has been seen.

Step 5 Display the master list of words and the count of how many times each word was seen. You can use either parallel arrays or structs

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!