C++ Break and Continue

#include <iostream>

int main() {
    // Break statement example
    for (int i = 1; i <= 5; ++i) {
        if (i == 3) {
            break; // Exit the loop when i is equal to 3
        }
        std::cout << "Iteration with break: " << i << std::endl;
    }

    // Continue statement example
    for (int j = 1; j <= 5; ++j) {
        if (j == 3) {
            continue; // Skip the rest of the loop body when j is equal to 3
        }
        std::cout << "Iteration with continue: " << j << std::endl;
    }

    return 0;
}