Break Statement
The break command can be used to exit a loop at any time. Here is one of the above examples that will only print Hello once and then break out of the loop.
int x;
for (x = 1; x <= 10; x++)
{
cout << "Hello\n";
break;
}
Continue Statement
The continue command lets you start the next iteration of the loop. The following example will not print Hello because the continue command goes back to the beginning of the loop each time.
int x;
for (x = 1; x <= 10; x++)
{
continue;
cout << "Hello\n";
}