#include <iostream> #include<cstring> using namespace std; int mystrcmp(const char* src, const char* dst); int main() { char s1[100] = { 0 }; char s2[100] = { 0 }; cin.getline(s1, sizeof(s1)); cin.getline(s2, sizeof(s2)); int ret = mystrcmp(s1, s2); cout << ret << endl; return 0; } int mystrcmp(const char* s1, const char* s2) { int len1=strlen(s1); int len2=strlen(s2); // write your code here...... while(*s1!='\0' && *s2!='\0'){ if(*s1==*s2) {s1++;s2++;} else if(*s1>*s2) return (1); else if(*s1<*s2) return (-1); } if(*s1=='\0'&&*s2 =='\0') return 0; else if(*s1!='\0') return(1); else if(*s2!='\0') return(-1); return 0; }