在C++编程中如何自编一个比较两个字符串s和t大小的函数strcomp(s,t)

要求:s小于t时返回-1,s等于t时返回0,s大于t时返回1.在主函数中任意输入4个字符串,利用该函数求最小字符串,并输出该字符串。(本人初学C++,希望各位大神指教)

这里有
http://blog.csdn.net/yushuai007008/article/details/7626446

 int strcomp(char *s, char *t)
{
    while (*s != '\0' && *t != '\0')
        {
            if (*s - *t > 0) return 1;
                if (*s - *t < 0) return -1;
            s++;t++;
        }
    if (*s - *t > 0) return 1;
        if (*s - *t < 0) return -1;
        return 0;
}

遍历挨个比较字符即可