Find the error(s) in each of the following, and explain how to correct it (them):
```
a) string string1{28}; // construct string1
string string2{'z'}; // construct string2
b) // assume std namespace is known
const char* ptr{name.data()}; // name is "joe bob"
ptr[3] = '-';
cout << ptr << endl;
```
a) Constructors for class string do not exist for integer and character arguments. Other
valid constructors should be used—converting the arguments to strings
b) Function data does not add a null terminator. Also, the code attempts to modify a
const char. Replace all of the lines with the code:
```
cout << name.substr(0, 3) + "-" + name.substr(4) << endl;
```
You might also like to view...
Search the web for “Graphics Libraries in C++.” Find three products that provide C++ classes that you can incorporate into your C++ program. Give a brief description of the tools they provide.
What will be an ideal response?
If my program is calling a function that returns an integer value, what do I need to remember to have in the call statement so that I obtain and keep that integer value?
What will be an ideal response?
The way field values are stored, displayed, and processed in an Access database is determined by the ____________________.
Fill in the blank(s) with the appropriate word(s).
The increase in broadband Internet access, together with access to inexpensive video equipment and webcams, has made creating personal video clips and sharing them online a very popular activity.
Answer the following statement true (T) or false (F)