How I'll stop my infinite loop in c++ program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How I'll stop my infinite loop in c++ program?

9th May 2020, 2:16 PM
Ganesh Kumar Nayak
Ganesh Kumar Nayak - avatar
3 Answers
+ 2
Ctrl +c or ctrl+d Or put a break at first with a condition specified if you don't want the loop to excute infinitely after some time
9th May 2020, 2:23 PM
Abhay
Abhay - avatar
+ 1
Put a breaking point in ur loop like int a = 1, flag = 0; while(a) //Always true { cout<<"Abhay is Great \n"; flag += 1; if(flag>50) // breaking condition break; }
9th May 2020, 2:28 PM
Abhay
Abhay - avatar
+ 1
When u using loop in progrm give proper condition and use break statement else it can run infinite times
11th May 2020, 10:31 AM
A S Raghuvanshi
A S Raghuvanshi - avatar