- 1

Who works break with loop in c++

please tell me the answar

27th Dec 2016, 6:45 PM
Nadeem Qasimy
Nadeem Qasimy - avatar
7 Réponses
+ 4
It can exit the loop.
27th Dec 2016, 7:10 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 4
it won't reach 10 as normal, it'll break at 2.
27th Dec 2016, 7:19 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 2
for(int i=0;i<10;i++){ cout<<i<<endl; if(i==2){ break; } } output: 0 1 2
27th Dec 2016, 7:08 PM
Mateusz Kifner
Mateusz Kifner - avatar
+ 1
you mean "how break work in loops?" it ends the execution of loop.
27th Dec 2016, 7:05 PM
Mateusz Kifner
Mateusz Kifner - avatar
+ 1
show me in one example please
27th Dec 2016, 7:08 PM
Nadeem Qasimy
Nadeem Qasimy - avatar
+ 1
example above
27th Dec 2016, 7:16 PM
Mateusz Kifner
Mateusz Kifner - avatar
+ 1
Thanks allot
27th Dec 2016, 7:18 PM
Nadeem Qasimy
Nadeem Qasimy - avatar