Structured solution without using a jump statement
<p>From Schaums C++ text</p>

<p>Removal of goto- says use a flag</p>

<p>code segment:</p>

<pre><code>const int N2 = 5;
int i, j, k;

  for (i = 0; i &lt; N2; i++)
  { for (j = 0; j &lt; N2; j++)
    { for (k = 0; k &lt; N2; k++)
       if (i + j + k &gt; N2)
           goto esc;
       else
          cout &lt;&lt;  i + j + k &lt;&lt; " ";
       cout &lt;&lt; "* ";
    }
   esc: cout &lt;&lt; "." &lt;&lt; endl;
  }
</code></pre>

<p>The solution:</p>

<pre><code>const int 5;
int i, j, k;
bool done = false;
  for (i = 0; i &lt; N2; i++)
  { for (j = 0; j &lt; N2 &amp;&amp; !done; j++)
    { for (k = 0; k &lt; N2 &amp;&amp; !done; k++)
       if (i + j + k &gt; N2)
           done true;
       else
          cout &lt;&lt;  i + j + k &lt;&lt; " ";
       cout &lt;&lt; "* ";
    }
   cout &lt;&lt; "." &lt;&lt; endl;
   done = false;
  }
</code></pre>

<p>The output of the structured solution does not produce the same result...as the goto one...
I can't see the problem</p>

<ol>
<li>Also, what would be another way to eliminate the goto?- Could I not use a flag and just compliment the condition.</li>
</ol>

<p>Thanks ...</p>
