+ 4

What is infinite loops

can u explain with a real life example

1st Feb 2017, 4:20 PM
Ron Mathew Jacob
Ron Mathew Jacob - avatar
13 Antworten
+ 15
while (true) { //your are breathing until you die, this can be called infinite loop....^_^ }
1st Feb 2017, 4:23 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 13
in a very simple word a infinite loop is endless loop . & a real life example  of infinite loop is: a daily calendar.
1st Feb 2017, 7:32 PM
sonali
sonali - avatar
+ 11
@valentin.. it will break when you die 😂😂
1st Feb 2017, 5:42 PM
Pankaj Vaghela
Pankaj Vaghela - avatar
+ 5
a loop which never get a condition for terminating itself. eg- for(;;) { } while(true) { }
1st Feb 2017, 4:23 PM
Thomas Sudeep Benardo
+ 5
infinite loop with use..... int choice; while(1)//infinite loop { cout<<"Press 1 to push"; cout<<"press 2 to pop"; cout<<"Press 3 to exit"; cout<<"Enter your choice"; cin>>choice; switch(choice){ case 1://do push code here..... break; case 2://do pop code here..... break; case 3:exit();//infinite loop ends if this case occures default:cout<<"Wrong Input"; break; } }
1st Feb 2017, 4:33 PM
Avnish Tomar (CCS University)
Avnish Tomar (CCS University) - avatar
+ 3
@sona, a daily calender......I like it :)
2nd Feb 2017, 2:54 AM
NEVEN RAJ KAUNDER A/L SIVA RAJA -
NEVEN RAJ KAUNDER A/L SIVA RAJA - - avatar
+ 2
Maybe you want your program to keep resetting after each use for example: I made a calculator, I want to user to input whatever and when they get the result, It will loop the whole program or the input getting methods again.
1st Feb 2017, 4:26 PM
Dawzy
Dawzy - avatar
+ 2
it has no end
1st Feb 2017, 5:15 PM
Selmi Amer
Selmi Amer - avatar
+ 2
it has no end
1st Feb 2017, 5:15 PM
Selmi Amer
Selmi Amer - avatar
+ 2
for(int i=0;;i++)
1st Feb 2017, 10:32 PM
ayoub
+ 1
Guysss, I found a real life example(inside TV) on infinite loop. It Spongebob's Best Day Ever Song. Hehehe... :)
2nd Feb 2017, 1:15 PM
NEVEN RAJ KAUNDER A/L SIVA RAJA -
NEVEN RAJ KAUNDER A/L SIVA RAJA - - avatar
+ 1
an endless loop is known as infinite loop
16th Feb 2017, 3:53 AM
MEDHIR
MEDHIR - avatar
0
this is a infinite loop. 0x2=0 it will keep doing it until it gets to 10 which won't happen since 0 times anything will always be 0 lol public class Program { public static void main(String[] args) { for(int x=0; x<=10; x=x*2) { System.out.println(x); } } }
21st Feb 2017, 10:10 PM
Ali Teyza
Ali Teyza - avatar