Self-Review Exercises

  1. 21.1 Fill in the blanks in each of the following:

    1. Header       must be included for class string.

    2. Class string belongs to the       namespace.

    3. Function       deletes characters from a string.

    4. Function       finds the first occurrence of one of several characters from a string.

  2. 21.2 State which of the following statements are true and which are false. If a statement is false, explain why.

    1. Concatenation of string objects can be performed with the addition assignment operator, +=.

    2. Characters within a string begin at index 0.

    3. The assignment operator, =, copies a string.

    4. A pointer-based string is a string object.

  3. 21.3 Find the error(s) in each of the following, and explain how to correct it (them):

    1. string string1{ ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.