Copying Strings
#include <iostream> #include <string> using namespace std; int main( ) { string s1( "this is a test" ); string s1_copy; s1_copy = s1; string s1_duplicate( s1 ); cout << "String 1: " << s1 << "\nCopy of String 1: " << s1_copy << "\nDuplicate of String1: " << s1_duplicate; string s2( "B" ); cout << "\n\nString 2: " << s2; s1 = s2.substr( 0, 6 ); cout << s1; }