2/6/00
COM1100 Winter2000 Yuhong Yin
10
continue statement example
n
for (int i = 1; i <= 10; i++) {
n
int r = i % 3;
n
if ( r == 0 ) {
//skip every 3th time
n
continue;
n
}
n
else {
n
cout << " i = " << i;
n
}
n
}
n
cout << “\n End of loop” << endl;
n
n
Output : i = 1 i = 2 i = 4 i = 5 i = 7 i = 8 i = 10
End of loop