Question: Please use linked list in C++ to write the code In this problem, you are required to write a program that reads words from a
Please use linked list in C++ to write the code
In this problem, you are required to write a program that reads words from a text file into a dictionary. Each time a word is encountered in the text file for the first time, it should be added to the dictionary and a counter associated with the word should be initialized to 1. Each time the word is subsequently encountered in the text file, the counter should be incremented by 1. One of primary tasks here is to differentiate strings from words. A string is a contiguous sequence of characters, not containing any space characters, that is followed by a space character. A word is a string containing only alphabetic characters. For example, in the line of text These strings are all words , each string is a word. However, in the line of text These $trings are ! a11 words The string $trings is not a word because $ is not an alphabetic character. The string ! is not a word because ! is not an alphabetic character. The string a11 is not a word because 1 is not an alphabetic character. The string words is not a word because it is not terminated by a space character.
After the dictionary is built, your program should output the words in alphabetical order along with their associated counters. An example is shown below.
(a,127) (after,1) (begin,22) (cat,1) ... (yankee, 2) (zebra, 1)
Then, your program should delete all words whose count is greater than 1 and output the remaining words in alphabetical order along with their associated counters. An example is shown below.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
