Question: C++, exercise #12 The following statement declares a variable to be of type string and assigns the string Johnson to this variable: string lastName=Johnson; The

C++, exercise #12
C++, exercise #12 The following statement declares a variable to be of

The following statement declares a variable to be of type string and assigns the string Johnson to this variable: string lastName="Johnson"; The data types mentioned previously in this lab are built-in data types. The string data type is programmer-defined and is supplied by the C++ standard library. Thus we must include in any program that uses strings the following preprocessor directive. #include This directive contains declarations about the string data type. Operations on string data include comparing the values of strings, searching a string for a particular character, and joining one string to another. In this lab we wish to discuss the operation that allows us to join one string to another called concatenation. This operation is performed by using the + operator. The result of concatenating (joining) two strings is a new string containing the characters from both strings. For example, given the statements: string lastName "Smith"; string firstName = "Jill"; string name; name = firstName + lastName; cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!