//: C03:AddStrings.cpp // From "Thinking in C++, Volume 2", by Bruce Eckel & Chuck Allison. // (c) 1995-2004 MindView, Inc. All Rights Reserved. // See source code use permissions stated in the file 'License.txt', // distributed with the code package available at www.MindView.net. #include #include using namespace std; int main() { string s1("This "); string s2("That "); string s3("The other "); // operator+ concatenates strings s1 = s1 + s2; assert(s1 == "This That "); // Another way to concatenates strings s1 += s3; assert(s1 == "This That The other "); // You can index the string on the right s1 += s3 + s3[4] + "ooh lala"; assert(s1 == "This That The other The other oooh lala"); } ///:~