How to exit a premature loop?
Answers
Answered by
2
Answer:
In a simple loop, the test expression is the sole factor that determines when the loop stops. When the test expression of a simple loop yields false, the loop terminates. However, as loops become more complex, we may need to arbitrarily terminate a running loop regardless of the value of the test expression. To do so, we use the break and continue statement.........
Answered by
1
An example:
int main()
{
for (int i=0;i<100;i++)
{
cout<<i<<endl;
break;
}
}
Output:
1
Similar questions
Math,
3 months ago
English,
3 months ago
Math,
7 months ago
Environmental Sciences,
7 months ago
Chemistry,
10 months ago
Social Sciences,
10 months ago