/* testrep7.cpp CIS 150 6/7/2005 David Klick Demonstration of continue within a loop. Be careful with continue. It can easily cause infinite loops with while and do/while loops. */ #include using std::cout; int main(void) { int ctr; // loop counter // display numbers from 1 to 10, but skip 7 for (ctr=1; ctr<=10; ctr++) { if (ctr == 7) continue; cout << ctr << " "; } cout << '\n'; return 0; } /* Sample output: 1 2 3 4 5 6 8 9 10 */