STRING CONCATENATION USING OPERATOR OVERLOADING

/*PROGRAM TO IMPLEMENT STRING CONCATENATION USING OPERATOR OVERLOADING*/

#include<conio.h>

#include<iostream.h>

#include<stdio.h>

#include<string.h>

class string_concat

{

char name[20];

public:

void input()

{

gets(name);

}

void output()

{

cout<<name<<endl;

}

string_concat operator+(string_concat s2)

{

string_concat s;

strcpy(s.name,” “);

strcat(s.name,strcat(name,” “));

strcat(s.name,s2.name);

return(s);

}

};

void main()

{

string_concat s1,s2,s3;

clrscr();

cout<<“Enter first name: “;

s1.input();

cout<<“Enter last name: “;

s2.input();

cout<<“first name is: “;

s1.output();

cout<<“Last name is: “;

s2.output();

s3=s1+s2;

cout<<“Complete name is: “;

s3.output();

getch();

}