21.1 Fill in the blanks in each of the following:
Header must be included for class string
.
Class string
belongs to the namespace
.
Function deletes characters from a string
.
Function finds the first occurrence of one of several characters from a string
.
21.2 State which of the following statements are true and which are false. If a statement is false, explain why.
Concatenation of string
objects can be performed with the addition assignment operator, +=
.
Characters within a string
begin at index 0
.
The assignment operator, =
, copies a string
.
A pointer-based string is a string
object.
21.3 Find the error(s) in each of the following, and explain how to correct it (them):
string string1{28}; // construct string1
string string2{'z'}; // construct string2
// assume std namespace is known
const char* ptr{name.data()}; // name is "joe bob"
ptr[3] = '-';
cout << ptr << endl;