Use overloaded string concatenation operator with a char * string - C++ STL

C++ examples for STL:string

Description

Use overloaded string concatenation operator with a char * string

Demo Code

#include <iostream> 
#include <string> 
using namespace std; 

int main() /*from  www . j  a  v  a 2s .c o  m*/
{ 
    string s1( "happy" ); 
    string s2( " birthday" ); 
    string s3; 

   cout << "\n\ns1 += \" to you\" yields" << endl; 
   s1 += " to you"; 
   cout << "s1 = " << s1 << "\n\n"; 

}

Result


Related Tutorials