Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Activity: Individual words from std::string to std::vector Graded Playground Autograder This is due on Monday, January 2 9 , 2 0 2 4 at 2
Activity: Individual words from std::string to std::vector
Graded Playground Autograder
This is due on Monday, January at : CST
You have not attempted this activity. You currently have for this activity.
In this activity, you will implement std::vector WordsToVectorstd::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 removed from it
Consider the following examples std::string std::vector
Hello, World! Hello "World"
What is your name? Whatis "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 forstatement. Finally, you can use these two functions to implement WordsToVector.
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