Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In c++ please. Implement the function: string* createWordsArray (string sentence, int& outWordsArrSize) This function gets a string sentence containing a sentence. When called, it should

In c++ please. Implement the function: string* createWordsArray (string sentence, int& outWordsArrSize)

This function gets a string sentence containing a sentence. When called, it should create and return a new array (of strings), that contains all the words sentence. The function should also update the output parameter, outWordsArrSize, with the logical size of the new array that was created.

Note: Assume that the words in the sentence are separated by a single space.

For example, if sentence=You can do it, after calling createWordsArray(sentence, outWordsArrSize), the function should create and return an array that contains [You , can , do , it], and update the value in outWordsArrSize to be 4.

Implementation requirements: 1.You may want to use some of the string methods, such as find, substr, etc. 2.Your function should run in linear time. That is, if sentence contains n characters, your function should run in theta (n). 3. Write a main() program that tests this function.

I keep getting the error, "cannot invoke char..."

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

At what level(s) was this OD intervention scoped?

Answered: 1 week ago