C++ Program to concatenate two strings using strcat function


In this program, You will learn how to concatenate two strings using strcat function in C++.


strcat(str1, str2);


Example: How to concatenate two strings using strcat function in C++

Run it Now
#include<iostream>
#include<cstring>
using namespace std;

int main() {

    char str1[100], str2[100];

    cout << "Enter First String :";
    cin.getline(str1, 100);

    cout << "\nEnter Second String :";
    cin.getline(str2, 100);

    strcat(str1, str2);

    cout << "\nConcatenate String is :" << str1;

    return 0;
}

Output:

Enter First String :Learn
Enter Second String :C++
Concatenate String is :LearnC++