Kisses93834
asked on
Looking for lexicographical_compare example
Please post lexicographical_compare example
ASKER
I'm reffering to the lexicographical_compare function that is part of the std standard template library.
I need an example using that function.
I need an example using that function.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
anyways u have direct functions under string.h
strcmp() (case sensitive)
strcmpi() (case insensitive)
for comparision
u just need to specify
strcmp(s1,s2)
will return 0 if s1=s2
will return >0 if s1 > s2
will return <0 if s1 < s2
strcmpi() behaves in the same fashion
if u wanna create ur own function to simply check whether there is a match or not its like this
the function is
int StringCompare(char *s1,char *s2)
{
int i=0,ret_val = 0;
while((s1[i]==s2[i])&&s1[i
i++;
if(s1[i]==NULL&&s2[i]==NUL
{
//MATCH FOUND
ret_val = 1;
}
return ret_val;
}
the above function returns 1 if a match is found and 0 if a match is not found....