
String Concatenation is the process of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball".
The + operator can be used between strings to add them together to make a new string.
We can also add a space after firstName to create a space between Hello and World on output. However, you could also add a space with quotes (" " or ' '):
Single String
#include <iostream>
#include <string>
using namespace std;
int main () {
string firstName = "Hello";
string lastName = "World";
string fullName = firstName + lastName;
cout << fullName;
return 0;
}
Output:

Multiple Strings
#include <iostream>
#include <string>
using namespace std;
int main () {
string firstName = "The Tech ";
string lastName = "Platform";
string fullName = firstName + lastName + " " + "is your own platform, managed by you as your blog/website where you share your expertise, knowledge through your content ";
cout << fullName;
return 0;
}
Output:

The Tech Platform
Comments