C++ examples for Statement:break
Break statement causes a loop to end immediately, instead of waiting for its condition to be false.
#include <iostream> int main() /*from www . j a v a 2 s . c o m*/ { int counter = 0; int multiples = 0; while (true) { counter++; if (counter % 14 == 0) { std::cout << counter << " "; multiples++; } if (multiples > 19) break; } std::cout << "\n"; return 0; }