There is a mistake in the code<p><pre><code>    for (size_t i = numBurritos - 1; i &gt;= 0; i++)
        if (wantBurrito(i))
            break;
</code></pre>
Apart from the didactic bug that <i>i &gt;= 0</i> is always true for <i>size_t</i>, this is supposed to count down, so i++ should be replaced with i--:<p><pre><code>    for (size_t i = numBurritos - 1; i &gt;= 0; i--)
        if (wantBurrito(i))
            break;</code></pre>