Define a class called Text whose objects store lists of words. The class Text will be just like the class StringVar except that the class Text will use a dynamic array with base type StringVar rather than base type char and
will mark the end of the array with a StringVar object consisting of a single blank, rather than using '\0' as the end marker. Intuitively, an object of the class Text represents some text consisting of words separated by blanks.
Enforce the restriction that the array elements of type StringVar contain no blanks (except for the end marker elements of type StringVar).
Your class Text will have member functions corresponding to all the member functions of StringVar. The constructor with an argument of type const char a[] will initialize the Text object in the same way as described below for input_line. If the C-string argument contains the new-line symbol '\n', that is considered an error and ends the program with an error message.
The member function input_line will read blank separated strings and store each string in one element of the dynamic array with base type StringVar.
Multiple blank spaces are treated the same as a single blank space. When
outputting an object of the class Text, insert one blank between each value of
type StringVar. You may either assume that no tab symbols are used or you can treat the tab symbols the same as a blank; if this is a class assignment, ask your instructor how you should treat the tab symbol.
Add the enhancements described in Programming Project 6. The
overloaded version of the extraction operator >> will fill only one element
of the dynamic array.
Sorry the answer is not available at the moment…
If you are able to find the answer, please make sure to post it here. So that your Juniors have smile on their lips and feel happy.
Spread the 'tradition of sharing'.