STL concatenate strings c++ code example
Example 1: c++ string concatenation
string first_name = "foo"
string last_name = "bar"
std::cout << first_name + " " + last_name << std::endl;
Example 2: concatenate two strings in c++
#include <iostream>
using namespace std;
int main()
{
string s1, s2, result;
cout << "Enter string s1: ";
getline (cin, s1);
cout << "Enter string s2: ";
getline (cin, s2);
result = s1 + s2;
cout << "Resultant String = "<< result;
return 0;
}