Question: In C++ In this activity, you will implement std: : vector WordsToVector(std: : string str) in utilities. cc. This function must: - Takes a single

In C++

In C++ In this activity, you will implement std: : vector WordsToVector(std:: string str) in utilities. cc. This function must: - Takes asingle std: : string as its argument - Return a std: :vector where each word (whitespace delimited) in the parameter str is an

In this activity, you will implement std: : vector WordsToVector(std: : string str) in utilities. cc. This function must: - Takes a single std: : string as its argument - Return a std: : vector where each word (whitespace delimited) in the parameter str is an element, with all occurrences of the punctuation {!,?,,}removedfromit. Consider the following examples (std::string > std::vector) - Hello, World! { "Hello", "World" } - What is your name? >{ "What", "is", "your", "name" } - Who? What? Where? Why? How? >{ "Who", "What", "Where", "Why", "How" } Do not include any libraries other than and in your solution. Recommended process Please do not overcomplicate this problem by attempting to use language facilities we have not taught. You can solve this problem using a combination of selection, iteration, and string concatenation. That's all you need! Don't try to implement your solution to the whole problem at once! I recommend that you first create a function that removes the punctuation from an input string and returns a new string, containing all the original words, albeit with the punctuation removed. Before moving on, you can test your implementation driver. cc. Thereafter, you can define another function that returns an std: : vector that "splits" on whitespace an input string into a vector of "words"; extracting the last word will likely be a special case. You can test your wordextracting function by invoking it from the main function and printing out the contents of the std: : vector it returns using a for-statement. Finally, you can use these two functions to implement wordsTovector. \( \begin{array}{ll}1 & \text { include "utilities.hpp" } \\ 2 & \\ 3 & / / \text { define words_to_vector here } \\ 4 & \end{array} \) words-from-str-to-vect driver.cc utilities.cc utilities.hpp CS 128 A+ Editor

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!