#include <stdio.h>
int mystrcmp(const char *str1,const char * str2)
{
int ret = 0;
while(1)
{
ret = *str1 - *str2;
if((ret != 0)||(*str1 == '\0'))
{
break;
}
str1++;
str2++;
}
return ret;
}
int main()
{
char str1[100] = {'\0'};
char str2[100] = {'\0'};
int ret = 0;
puts("please intput two string to strcmp,the two string length max = 99");
puts("eg: abcdef ABCDEF");
scanf("%s%s",str1,str2);
printf("\n");
ret = mystrcmp(str1,str2);
if(ret > 0)
{
printf("result: %s > %s\n",str1,str2);
}
else if(ret == 0)
{
printf("result: %s = %s\n",str1,str2);
}
else
{
printf("result: %s < %s\n",str1,str2);
}
}