C++ examples for Statement:break
The break statement applies to the middle loop as shown here:
#include <iostream> using namespace std; int main()//from w ww .j a v a 2 s . c o m { int x,y,z; for (x = 1; x <= 3; x++) { for (y = 1; y < 3; y++) { if (y == 2) break; for (z = 1; z < 3; z++) { cout << x << " " << y; cout << " " << z << endl; } } } return 0; }