//BCA Support
//www.bcasupport.xyz
#include <iostream.h>
#include <conio.h>
#include <string.h>
class string
{
public:
char text[20];
string()
{
strcpy(text,'\0');
}
string(char txt[])
{
strcpy(text,txt);
}
string operator+(string &s)
{
string newtext;
strcat(newtext.text,text);
strcat(newtext.text,s.text);
return newtext;
}
};
int main()
{
clrscr();
string s1("Hello ");
string s2("World!");
string s3=s1+s2;
cout<<"\nString 1 : "<<s1.text;
cout<<"\nString 2 : "<<s2.text;
cout<<"\nString 3 : "<<s3.text;
getch();
return 0;
}
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.