Function not returning default value C++ : <p>This code will return the values of 1 or 0 when those returns are called, but if it falls to the default return value of 2, it doesn't return it. I'm sure it's something small I'm missing, but I can't figure it out. </p>

<pre><code>int comp(string a, string b){
    char x;
    char y;
    int i = 1;
    int len;
    len = a.length();
    if(b.length() &lt; (unsigned)len){
        len = b.length();
    }
    len++;
    while(i!=len){
        x = a.at(i);
        y = b.at(i);
        if(getNum(x) &lt; getNum(y)){
            return 1;
        }
        else if (getNum(x) &gt; getNum(y)){
            return 0;
        }
        i++;
    }
    return 2;   
}
</code></pre>
