Jump Stetments
Jump Stetments
• break
• continue
break;
Effect:
• When the break statement is executed inside a loop-
statement, the loop-statement is terminated
immediately
• The execution of the program will continue with the
statement following the loop-statement
Example:
//print the number, as soon as, you see 5 terminate the loop
• Schematically:
The continue statement
• Syntax:
continue;
• Schematically:
Example-1: print all the numbers from 1 to 10 except 4 .
#include "q3.h"
#include <iostream>
#include <iomanip>
using namespace std;
q3::q3()
{
for (int i = 1; i <=10; i++)
{
if(i==4)
continue;
cout<<i<<endl;
}
}