Question: This is a C program designed to compile using -std=c99, -pedantic, and -Wall . overall, a terminal should be used to run the program with

This is a C program designed to compile using -std=c99, -pedantic, and -Wall . overall, a terminal should be used to run the program with these commands to test the program for warnings, errors, if output is correct, etc.

This program must read in a set of words, that may be repeated from terminal, and have a frequency count performed on then. The five most common words and their frequency must be displayed.

The program should read words directly from the terminal, and the end of the input will be the word 'zzzzz' which is not part of the frequency count.

A word in this case is a contigious set of 20 or less lowercase letters. No numbers or punctuation marks will be in the set. For purposes related to the design of this program, there will be no more than 200 unique words and 500 total words, so the program should be designed to handle this, as well as ignoring any spaces, tabs, newlines, any whitespace, etc.

An input prompt is not required but the output should be neatly formatted. From these 500 total words, the program is designed to print out the FIVE MOST frequently occuring words, and their frequency. Words with the same frequency need to be in alphabetical order.

Any output found before an equals sign (=) will be ignored, and the testing apparatus will look for the five most fequent words. The format on each line should consist of the frequency, followed by whitespace, followed by the word. The example provided uses tabs but this is not a hard requirement.

Finally, this program requires a main() as well as one other function that is utilized to perform these tasks. Everything should be contained in a freq.c file.

The sorting may be done however you like, qsort() is also a tool we can use. The program needs at least one array, likely two arrays. No global variables allowed, everything needs to be within a function or as a parameter Use of structs is not required but can be done The code must compile with no warnings or errors using -std=c99, -pedantic, and -Wall

using a list of words [ words.txt ], it should look like this:

./freq < words.txt

./freq

you cannot eat eating is for the strong eating is the big death that consumes you you will confront your habits you will allow your habits to pass pass through when it is gone you will look inwards where food has gone there will be everything there will be no one there zzzzz

Count Word ===== ==== 5 will 5 you 3 is 3 there 2 be

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!