Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. The main function opens and closes the files, utilizes a read-till-end-of-file loop that calls getline() to read the input file, line by line, and

image text in transcribed

1. The main function opens and closes the files, utilizes a read-till-end-of-file loop that calls getline() to read the input file, line by line, and calls the other functions, main() is relatively short 2. As each line is read, echo print it and call a function that tokenizes the C-string into words and stores each unique word in a 2-D array of char or an array of word structures. (your choice) The tokenizer function adds each new word to the array of words or word structs, updates the number of times the word has been seen, and keeps track of the total word count and total unique word count. 3. To do its job, the tokenizer function calls a linear search function that checks to see if the newly found word is not already in the words array. Suggestion: declare a parallel array of integers that stores the number of times a word has been seen. Alternate suggestion: Store each unique word and the count of how many times it appears in a struct variable and declare an array of these word structures. 4. Write a function that sorts the words array in alphabetic order. 5. Write a function (or functions) that a. finds the location of the longest word. If there is a tie for longest, choose one. b. finds the total number of words of length 1-3 characters, such as: 'a', 'or', 'the' in the file. c. finds the location of the word that occurred most frequently. 6. Write a function that outputs all unique words found in sorted order with their occurrence counts, one word/count pair per line into an output file and writes the longest word found, the word that occurred most frequently, and the number of short words found

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Database Concepts

Authors: David Kroenke, David Auer, Scott Vandenberg, Robert Yoder

10th Edition

0137916787, 978-0137916788

More Books

Students also viewed these Databases questions