Concating Two String in C++ Program


#include <iostream>
using namespace std;
#include <cstring>
int main()
{
    char i[25]="Hello";
    char j[25]="World";
    cout<<"Before i and j:"<<endl;
    cout<<"i is: "<<i<<endl;
    cout<<"j is: "<<j<<endl;
    strcat(i,j);
    cout<<"After concating:"<<endl;
    cout<<i<<endl;
    system("pause");
    return 0;
}

The output is given below:
Before i and j:
i is: Hello
j is: World
After concating:
HelloWorld

0 comments:

Post a Comment