Pages

Thursday, 5 March 2020

Chapter 11 // Exercise 11 - Principles & Practice Using C++

In this exercise I am using Visual Studio Community 2017 and the header file "std_lib_facilities.h" which can be found here:

http://www.stroustrup.com/Programming/PPP2code/std_lib_facilities.h

Chapter 11 // Exercise 11

Write a function vector<string> split(const string& s, const string& w) that
returns a vector of whitespace-separated substrings from the argument s, where
whitespace is defined as "ordinary whitespace" plus the characters in w.
Again, on this one I'm assuming that he means add a break at whitespace and the string w? Eg if w is "break" and the line "I like to eat donuts on my break everyday" is entered; the following would be entered in the vector:
[0] I
[1]
[2] like
[3]
[4] to
[5]
[6] eat
[7]
[8] donuts
[9]
[10] on
[11]
[12] my
[13]
[14] everyday




No comments:

Post a Comment