Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

break statement in c++ program

/*Q;Design a program to print the employee IDs starting
from 1 until an Id occur who have resigned. IDs of
resigned persons are 7 and 10 .*/

#include<iostream>
using namespace std;
int main()
{
	int meet=0;
	for(int i=1;i<30;i++) 
		{
			if(i==7||i==10)
			break;
			else
				meet=1;
		cout<<"Employee ID:"<<i<<endl;
		}
	return 0;
}
 
PREVIOUS NEXT
Tagged: #break #statement #program
ADD COMMENT
Topic
Name
4+1 =