Concatenating String Literals

Sometimes a string may be too long to conveniently fit on one line of code. C++ enables you to concatenate string literals—that is, to combine two quoted strings into one. Indeed, any two string constants separated only by whitespace (spaces, tabs, and newlines) are automatically joined into one. Thus, all the following output statements are equivalent to each other:

cout << "I'd give my right arm to be" " a great violinist. ";
cout << "I'd give my right arm to be a great violinist. ";
cout << "I'd give my right ar"
"m to be a great violinist. ";

Note that the join doesn’t add any spaces to the joined strings. The first character of the second string immediately follows the last character, not counting , of the first string. The character from the first string is replaced by the first character of the second string.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.140.204