#include<iostream.h>
#include<conio.h>
#include<string.h>
class mystring
{
char str[30];
int len;
public:
mystring(char *s)
{
strcpy(str,s);
}
int operator ==(mystring ms)
{
if(strcmp(str,ms.str)==0)
return 0;
else
return 1;
}
};
int main()
{
char s1[30],s2[30];
clrscr();
cout<<"\n\nEnter first string : ";
cin>>s1;
cout<<"\n\nEnter second string : ";
cin>>s2;
mystring obs1(s1),obs2(s2);
if(obs1==obs2)
cout<<"\n\nGiven strings are not same"<<"\n";
else
cout<<"\n\nGiven strings are same"<<"\n";
getch();
return(0);
}
Post a Comment