Introduction
I have used CodeBlocks compiler for debugging purpose. But you can use any C++ programming language compiler as per your availability.
#include <iostream> #include <cstring> using namespace std; int main() { char s1[50], s2[50], result[100]; cout << "Enter string s1: "; cin.getline(s1, 50); // Reading first string from user cout << "Enter string s2: "; cin.getline(s2, 50); // Reading second string from user strcat(s1, s2); // strcat is use to Concatenates two strings cout << "String obtained on concatenation is:" << s1 << endl; return 0; }
Result
// Online C++ Compiler – Build, Compile and Run your C++ programs online in your favorite browser
#include
using namespace std;
string s1, s2;
int main()
{
cout <> s1;
cout <> s2;
cout << "String obtained on concatenation is: " << s1 + s2;
return 0;
Is this code acceptable?