Continue statement is used inside loops. Whenever a continue statement is
encountered inside a loop, control directly jumps to the beginning of the loop
for next iteration, skipping the execution of statements inside loop’s
body for the current iteration.
/*Q: Design a program to print the employee IDs from 1 to 15 and skip the
IDs 7 and 10 because they have resigned.*/
#include<iostream>
using namespace std;
int main()
{
int meet=0;
for(int i=1;i<=15;i++)
{
if(i==7||i==10)
continue;
cout<<"Employe ID="<<i<<endl;
}
}
// program to print the value of i
#include <iostream>
using namespace std;
int main() {
for (int i = 1; i <= 5; i++) {
// condition to continue
if (i == 3) {
continue;
}
cout << i << endl;
}
return 0;
}