Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are tasked to write a program that will count the frequency of the given words in a particular sentence or a paragraph. The program
You are tasked to write a program that will count the frequency of the given words in a particular sentence or a paragraph. The program will first ask the user for a string input that is a sentence (or paragraph), then ask for N words that the user wants to search for in the sentence (or paragraph), and output the frequency for each. The sentence/paragraph must be a C-style string (array of characters ended by the null character, 10'), but the array of words can be C++ strings. The N words must be entered at one time before searching to see if the words are in the sentence/paragraph. In other words, you cannot ask for a word, search its frequency and then ask for another word. You must ask for all words before searching for the words. You must use a dynamic array allocated on the heap!!! You will not be given credit for a variable length array, which is not dynamically allocated on the heap, i.e. string array[num_words]; In addition, you must not have a memory leaks (use valgrind to help) Note: Word frequency is case insensitive. E.g. "the" and "The" are the same. se an array of C-style strings for the words, instead of C stings
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