Question
C++ Programming Question: The program should: 1. Read the name of the text file from the console. 2. Read in a text file, not all
C++ Programming Question:
The program should:
1. Read the name of the text file from the console.
2. Read in a text file, not all at once. (This can be line by line, word by word or character by character.)
3. The file content must be converted to a sequence of words, discarding punctuation and folding all letters into lower case.
4. Store the unique words and maintain a count of each different word.
5. The words should be ordered by decreasing count and, if there are multiple words with the same count, alphabetically. (This ordering may be achieved as the words are read in, partially as the words are read or at the end of all input processing.)
6. Output the first ten words in the sorted list, along with their counts.
7. Output the last ten words in the list, along with their counts. You must choose appropriate data structures and algorithms to accomplish this task.
Note: in the context of this task, appropriate choices will be efficient and will not use excessive instructions or data.
Note: where a punctuation mark appears between two letters, the sequence is to be treated as a single word. Thus, its will become its, youll will become youll and loop-hole will become loophole.
Note: you can assume that the input file contains no more than 50,000 different words.
Thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started