#include <iostream.h>
#include <conio.h>
#include <stdio.h>#include <string.h>
void main()
{
char sen1[50], sen2[50];
void chk_eq(char str1[], char str2[]);
cout<< "\n Enter String1 :";
gets(sen1);
cout<<"\n Enter String 2:";
gets(sen2);
chk_eq(sen1, sen2);
}
void chk_eq(char str1[], char str2[])
{
int l1,l2;
l1 = strlen(str1);
l2 = strlen(str2);
if(l1 == l2)
{
cout<<" \ n Two String are NOT equal ";
getch();
exit(1);
}
for( int i = 0; i<= l1 - 1 ; i++)
{
if(str1[i] ! = str2[i])
{
cout<<" \ n Two String are NOT equal ";
getch();
exit(1);
}
}
cout<< "\n Two Strings are EQUAL lengthwise , characterwise and casewise ";
getch();
}
No comments:
Post a Comment