Problem

Define a class called Text whose objects store lists of words. The class Text will be just...

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 die 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 die 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 Stri ngVar. 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 Stri ngVar. You may eidier 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

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 11
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT