adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

Program in C++ to add two string

Program in C++ to add two string


 #include<iostream>
 #include<conio.h>
 #include<string.h>
  using namespace std;
  void StrCat(char *str1,char *str2)
    {
        int i,l1,l2,c=0;
        l1=strlen(str1);
     l2=strlen(str2);
     for(i=l1;i<=l2+l1;i++)
      str1[i]=str2[i-l1];
    }

  int main()
    {
        char str[100],str1[100];
        cout<<" Enter first words:-";
        cin.getline(str,99);
        cout<<" Enter second words:-";
        cin.getline(str1,99);
        StrCat(str,str1);
        cout<<" Full words ="<<str;
        getch();
    }
Output:-









Post a Comment

0 Comments