Break Statement in c++




This video tutorial explains the break statement in c++.
you will learn what is the use of break statement, how to use break statement to terminate a loop in detail with example.

source code for this tutorial

#include <iostream>

using namespace std;

int main()
{
    int counter;

    for(counter =1 ; counter <= 5 ; counter++){

        int innercounter;
        for(innercounter = 1; innercounter <=3; innercounter++){
            cout << innercounter <<endl;
            if(innercounter == 2)
                break;
        }

    }

    return 0;
}

 
Back To Top