You’ve been tasked with identifying the most commonly used words in a particular text. I’ve supplied one here for you to use to test your functionality.

Using the C++ std library’s vector class to read the test file supplied. Put each word in the vector. E.g.,

vector words;

Note: You must be able to handle punctuation and carriage returns which occur within the text (i.e., throw them away).

How will the code function?

  • The user will be prompted via the console as to the name of the file to be read.
  • The code will then read the file and create “counts” for each unique word (i.e., the frequency of occurrence for each word in the text).
  • The code will then inform the user as to how many unique words there were in the text document as well as the most frequently occurring word(s) and the number of times it occurs.
  • The code will then prompt the user to enter in a word to see how frequently it occurs. (The user can do this as many times as he/she wants until he/she says she doesn’t want to anymore.)
  • The code will write out all of the unique words and the number of times each occurred in the format shown below to a file named “words_stats.txt”.
raven 10
tis 9
and 23
...
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.