In C++, find the 5 most frequent words and their frequency in a given text. User input should be the file name of a text file. ('input1.txt or 'input2.txt) 1. Read all the lines from the text - For...


C++


In C++, find the 5 most frequent words and their frequency in a given text. User input should be the file<br>name of a text file. ('input1.txt or 'input2.txt)<br>1. Read all the lines from the text<br>- For each line, parse the line into words (based on the white space)<br>- Replace punctuation with

Extracted text: In C++, find the 5 most frequent words and their frequency in a given text. User input should be the file name of a text file. ('input1.txt or 'input2.txt) 1. Read all the lines from the text - For each line, parse the line into words (based on the white space) - Replace punctuation with " " (whitespace) and parse. - Only consider alphanumeric characters and ignore case. 2. Sort the words by their count through a quick sort algorithm. - If there are two words with the same frequency, sort them alphabetically. 3. Print the 5 most frequent words with their frequency in all caps. (Example shown below.) Input: (input1.txt) Output: (in console) I love you and me. ME: 4 Me is great. LOVE: 3 You are great. YOU: 3 I love me. GREAT: 2 You love me. I: 2

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here