#include <iostream> #include <string.h> using namespace std; int strcmp1 (const char * a, const char * b) { int ret = 0; while (!(ret=*a-*b) && *b) { ++a; ++b; } return (ret>0)?(1):((ret<0)?(-1):(0)); } int main () { const char a[] = "acde"; const char b[] = "abcde"; cout << "a - b = " << strcmp1(a,b) << endl; return 0; }