Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn C++ programming concepts. You can learn C++ language at your own speed and time. One can learn concepts of C++ language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a C++ Program to Concatenate Two Strings
PROGRAM:C++ Program to Concatenate Two Strings
/* C++ Program to Concatenate Two Strings */
1: Concatenate String Objects
#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;
}
2: Concatenate C-style Strings
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char s1[50], s2[50];
cout << “Enter string s1: “;
cin.getline(s1, 50);
cout << “Enter string s2: “;
cin.getline(s2, 50);
strcat(s1, s2);
cout << “s1 = ” << s1 << endl;
cout << “s2 = ” << s2;
return 0;
}