#include
#include
#define M 10
/*238-5.编写比较字符串的函数(重现strcmp函数)*/
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int Strcompare(char *s1,char *s2)
{
while(*(s1++)==*(s2++)&&*(s1++)!='0'&&*(s2++)!='0')
{
}
return *s1-*s2 ;
}
int main(int argc, char *argv[])
{
char *s1,*s2,str1[M],str2[M];
int a;
gets(str1);
gets(str2);
s1=str1;
s2=str2;
a=Strcompare(s1,s2);
printf("%d",a);
return 0;
}