Quickpaste.it
Create Paste
Top Pastes
Recent Pastes
Settings
Account
Dinamic
Created By
Anonymous
Expires never
Raw
Download
0
#include <iostream.h> #include <conio.h> #include <string.h> class cstring { char *s1, *s2; int len; public: cstring(char *x,char *y) { s1 = new char[strlen(x) + 1]; strcpy(s1, x); s2 = new char[strlen(y) + 1]; strcpy(s2, y); } cstring(cstring &ob) { len = strlen(ob.s1); cout << "Length of s1: " << len << "\n"; if (strcmp(ob.s1, ob.s2) == 0) cout << "The given two strings are equal\n"; else cout << "The given two strings are unequal\n"; char *temp = new char[strlen(ob.s1) + strlen(ob.s2) + 1]; strcpy(temp, ob.s1); strcat(temp, ob.s2); cout << "Concatenating the given two strings: " << temp << "\n"; len = strlen(temp); cout<<"Reverse of the string:"; while (len--) cout <<temp[len]; delete[] temp; } ~cstring() { delete[] s1; delete[] s2; } }; void main() { clrscr(); char str1[25], str2[25]; cout << "Enter the two strings:\n"; cin >> str1 >> str2; cstring ob1(str1, str2); cstring ob2(ob1); getch(); }