Here we compare two string that they are equal or not.
program:
#include< iostream>
int main()
{
char ch1[20],ch2[20];
int i=0;
//input of string
cout<<"Enter first string"<< endl;
cin>>ch1;
cout<<"Enter second string"<< endl;
cin>>ch2;
while(ch1[i]!='' || ch2[i]!='')
{
if(ch1[i]!=ch2[i])
{
cout<<"Not same";
i=-1;
break;
}
i++;
}
if(i!=-1)
cout<<"Same";
}
Enter first string
Mystring
Enter second string
Mystring
Same
Enter first string
Mystring
Enter second string
My
Not same