C++ examples for Statement:break
Break statement exiting a for statement
#include <iostream> int main(int argc, const char *argv[]) { int count;// ww w. j av a2 s. com for (count = 1; count <= 10; ++count) { if (count == 5) break; std::cout << count << " "; } std::cout << "\nBroke out of loop at count = " << count << std::endl; return 0; }