Name implies
Break, have "broken (deadlock), end (difficult, unfavorable situation), Sever (contact)" meaning,
So the extension is "jump out of the break from the total cycle , the end of this cycle, do not execute the sentence after the break in this loop, and end the loop control Body"
and continue means "(after interruption) to continue",
So the extension is " from the continue end of this cycle , stop this cycle, do not execute the statement after the continue in this cycle, but (after the stop) did not jump out of the loop control body, continue to perform the cycle after this cycle"
The common denominator of the two is:
Will not execute the statement after the break/continue in this cycle;
The difference between the two points is:
Continue is the cycle after the continuation of the cycle after this cycle, and does not jump out of the loop control body;
The break refuses to perform the loop after this cycle and jumps out of the loop control body.
The sample program is as follows:
#include "stdio.h"
void Main ()
{
int n,m;
for (n=1;n<=15;n++)/ * This loop outputs 1 2 3 4, when n is 5, the loop exits */
{if (n==5) break
;
printf ("%d", n);
}
printf ("\ n");
for (m=1;m<=15;m++)/ * This circular output 1 2 3 4 6 7 8 9 10 11 12 13 14 15*/
{if (m==5)/ * When M is 5, there are no other statements that perform the secondary loop, so the 5*/continue is not exported
;
printf ("%d", m);
}
Getch ();
}