int i=0 ;while (a[i]!='\0'&&b[i]!='\0'&&a[i]==b[i]){ i++ ;} if (a[i]==b[i]){ return 0 ;} else if(a[i]>b[i]){ return -1;} else { return 1;} } int main(){ char a[20],b[20] ;printf("请输入两个字符串:\n") ;scanf("%s%s",a,b) ;...
int strcmp(char *p1, char *p2){ while (*p1 && *p2){ if (*p1 > *p2)return 1;else if (*p1 < *p2)return -1;else {p1++; p2++;} } if (*p1==0 && *p2==0)return 0;else if (*p1==0)return -1;else return 1;} ...