Question
(C++) Need help to store words from a file into a dynamic array and count frequency of those words. Write a program that reads in
(C++) Need help to store words from a file into a dynamic array and count frequency of those words.
Write a program that reads in a text file one word at a time. Store each word into a dynamically created array when it is first encountered. Create a parallel integer array to hold a count of the number of times that each particular word appears in the text file. If the word appears in the text file multiple times, do not add it into your dynamic array, but make sure to increment the corresponding word frequency counter in the parallel integer array. Remove any trailing punctuation from words before doing any comparisons. The easy way to check for this is to make sure you wind up with the word moon having a frequency of 2. Use the text from President John F. Kennedys speech at Rice University from September 12, 1962 (the GoToTheMoon.txt file is attached). No use of C++ strings, vectors, classes, etc., just a dynamic array of cStrings and a parallel array for counting them.
(GoToTheMoon.txt) = We choose to go to the moon. We choose to go to the moon in this decade and do the other things, not because they are easy, but because they are hard, because that goal will serve to organize and measure the best of our energies and skills, because that challenge is one that we are willing to accept, one we are unwilling to postpone, and one which we intend to win, and the others, too.
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