Day 11 : C++ Language | String Concatenation | Part -2

String Concatenation

It is the adding of 2 or more strings, which are connected using + sign.


#include<iostream>
#include<string>
using namespace std;
 int main(){
   string age = "23";
   string  name = "Aiera" ;
   string person = name + age;

   cout << person;
   return 0;
}



// output : Aiera23


#include<iostream>
#include<string>
using namespace std;
 int main(){
   string age = "23";
   string  name = "Aiera" ;
   string person = name + " " + age;

   cout << person;
   return 0;
}



// output : Aiera 23

Previous Blogs

Leave a Reply