Questions tagged [infinite-loop]

An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.

3528 questions
1
vote
0 answers

Moving a Div in a Semi - Circular path with infinite loop. Error

I'm trying to move a div on a semi circular path. I have tried the parametric equation and it works. I don't know why using for loops makes my program to stop working. When I try to move it using a for loop, The browser stops working and the memory…
GokulSrinivas
  • 383
  • 2
  • 10
1
vote
1 answer

DialogResult Infinite Loop

So I have this project at school to create a game "Guess the number". I am trying to loop a DialogResult using a switch statement and a while loop. I tried many possibilities but I go into a infinite loop. Just to know I am a beginner.I would really…
1
vote
2 answers

C++ Input a char instead of int lead to endless loop. How to check the wrong input?

One part of my program: Let user input a series of integer, and then put them into an array. int n=0; cout<<"Input the number of data:"; cin>>n; cout<<"Input the series of data:"; int a[50]; for(i=0; i>a[i]; } Then, when user…
Yingli Yan
  • 69
  • 1
  • 8
1
vote
3 answers

Python: Most efficient loop until condition

I have got to a point in my code where I need to do this: while True: if first_number == second_number: do_something() break The first number will keep incrementing beyond my control and I need to wait until this number reaches the value…
A_Porcupine
  • 1,008
  • 2
  • 13
  • 23
1
vote
1 answer

How to terminate empty infinite loop thread without using Thread.stop

One of my Runnable runs following code: while(true) {} I have tried wrapping that Runnable in Executor apis and then tried shutdown method. Tried thread.interrupt. but nothing works. I can not modify Runnable code. Any suggestions...
1
vote
0 answers

CakePHP shell infinite loop

I triggered CakePHP shell command in controller (AJAX POST call), and then the shell command ran into an infinite loop. I use the following code to print the trace. $dt = debug_backtrace(); $cs = ''; foreach ($dt as $t) { $cs .= $t['file'] . '…
Charles
  • 675
  • 3
  • 12
  • 21
1
vote
2 answers

Why does my program have an infinite-loop when I enter in a character?

#include #include #include #include using namespace std; int main() { char replay; int userInput; cout<< "Let's play Rock, Paper, Scissors"<
user2988803
  • 11
  • 1
  • 7
1
vote
0 answers

Routine to Play encrypted mp3 plays the file and then locks the app

I have a procedure that opens an encrypted mp3, decrypts it to a memory stream, and then uses NAudio to play it. The encrypted mp3 file plays okay, but then the app locks. I'm new to NAudio, and this is the first app I'm working on. Here's the code…
user3313540
  • 23
  • 1
  • 4
1
vote
1 answer

Loop condition in bash

In bash script, below while loop is supposed to print 1 to 4 number. But this one is resulting as an infinite loop. COUNT=1 while [ $COUNT < 5 ]; do echo $COUNT COUNT=$(($COUNT+1)) done Is there any fault in condition or syntax ? (I think…
Not a bug
  • 4,286
  • 2
  • 40
  • 80
1
vote
4 answers

Stopping an infinite loop in C++ when key is pressed

I have a program as given below: #include using namespace std; int main() { while(true) { //do some task if(Any_key_pressed) break; } return 0; } how can exit from the loop if any key is…
Satish Patel
  • 1,784
  • 1
  • 27
  • 39
1
vote
0 answers

jQuery .animate() infinite loop pauses when another animate function is called on same div

there is probably something obvious that im doing / not doing that would solve this but i just cant see the answer Im attempting to run an infinite loop in an animation and keep it running while i change that div's height in a separate animate…
1
vote
4 answers

As a beginning Pythoner I don't understand why I get an infinity loop with while?

This code always gives a infinity loop in while: pos1 = 0 pos2 = 0 url_string = '''

Daily News

This is the daily news.

end

''' i = int(len(url_string)) #print i # debug while i > 0: pos1 = int(url_string.find('>')) …
user1614113
  • 85
  • 2
  • 9
1
vote
3 answers

Finding vampire numbers from 10 to 1 million

I am a new C-learner and trying to find Vampire Numbers from 10 to 1 million. Vampire Number: http://en.wikipedia.org/wiki/Vampire_number The code is ready but, It doesn't work as It is supposed to. It just continues searching for a long time…
Sixie
  • 83
  • 1
  • 10
1
vote
2 answers

Foreach not working properly

I'm trying to write a method that takes some elements from Unity .config file. Each element has type and mapTo attributes, and I'm taking their string values, getting substrings I need and putting them in two separated lists. After that I want to…
nemo_87
  • 4,523
  • 16
  • 56
  • 102
1
vote
1 answer

Phonegap Infinite Loop Network Connection Check

Please help. I have the below function which is run infinitely: // Check the connection state of the device function checkConnection() { var networkState = ""; networkState = navigator.connection.type; var states =…
Tiaan Swart
  • 614
  • 5
  • 17