Questions tagged [cycle]

A cycle is a process or series of items, which repeats several times.

Cycle is processes or events, which repeat several times. Number of repetitions can be known before starting the cycle or cycle can be repeated until some condition is true.

1551 questions
-1
votes
4 answers

Why can't I exit the for cycle when the condition becomes false?

I want the cycle to end when "0 00 00" is typed by the user. Here's the code: main() { int i, o[128], m[256], s[256]; for(i = 0; o[i] != 0 && m[i] != 00 && s[i] != 00; i++) scanf("%d %d %d", &o[i], &m[i], &s[i]); …
m4mmt
  • 33
  • 1
  • 6
-1
votes
3 answers

How to increase speed of algorithm performance for calculation minimal number of moves?

I participate codefights and have the task find the minimal number of moves that are required to obtain a strictly increasing sequence from the input. As an input there are arrays of integers and accourding to the rule I can increase exactly one…
user21
  • 249
  • 3
  • 13
-1
votes
1 answer

getting data from server in cycle

my task is get from server data of an file with HTTP protocol but problem is that i dont know the size of the content so i iterate through read func to get data from socked but it iterates every time only once i dont know really why int res, len,…
krakra
  • 35
  • 8
-1
votes
1 answer

Need proper json response

I need json response in different array, but below code not give all the result. while ($row=mysqli_fetch_assoc($result)) { //$data[]=$row; $data['id']=$row['id']; $data['name']=$row['name']; $data['Latitude']=$row['Latitude']; …
-1
votes
1 answer

Strange behavior of cycle for(64-bit Windows 7/java version 1.8.0 25)

I have task: to make a java-programm which will print numbers from 000001 to 999999(it's a tram's tickets numbers) and count all numbers which have equilly left and right sides(for example: 024033, 125008, 531900 etc.). I wrote the code: public…
bbirdoff
  • 1
  • 1
-1
votes
1 answer

Strange working cycle in C

int n = 0; int temp = 0; while ((temp != 1) || (n <= 0)){ puts("enter array count"); temp = scanf("%d", &n); printf("\n%d\n", temp); } I need to check input value for the fact it must be an integer and be > 0. scanf returns count of success…
SwiftStudier
  • 2,272
  • 5
  • 21
  • 43
-1
votes
1 answer

output all characters and recognize end of js-function

i have put together the undermentioned script. it wont output the last character of the last source. i am not very well concerned with js and that is why i ask you. can anyone give me a clue? function jtype(source, step){ var str = source, i = 0,…
Bernhard
  • 1,852
  • 11
  • 19
-1
votes
1 answer

Jquery cycle audio

I'm using the jQuery cycle plugin for an app I'm writing, and it works fine using images. e.g. ...etc However, I would like to use the plugin with sound clips rather than images, and although the cycle…
Joe Bloggs
  • 69
  • 7
-1
votes
2 answers

Java > Array-2 > twoTwo

problem Given an array of ints, return true if every 2 that appears in the array is next to another 2. twoTwo({4, 2, 2, 3}) → true twoTwo({2, 2, 4}) → true twoTwo({2, 2, 4, 2}) → false my code is only mising this case twoTwo({2, 2, 7, 2, 1}) →…
Bodhert
  • 17
  • 1
  • 6
-1
votes
1 answer

how to combine bash cycle for with different variables

I have two networks: FORWARDS="10.0.0.0/8 192.168.0.0/16" In cycle I'm allowing tcp udp icmp from same network to same for ipo in $FORWARDS;do iptables -A FORWARD -p tcp -s $ipo -d $ipo -j ACCEPT iptables -A FORWARD -p udp -s $ipo -d $ipo…
Asunta
  • 1
-1
votes
1 answer

Algorithm for creating most efficient undirected Hamiltonian path

I am attempting to create an algorithm that creates a path that connects a graph of points together in the shortest/most efficient way, ensuring all points are connected and that each point has at most two connections. After doing some research, it…
Bill Peet
  • 477
  • 1
  • 8
  • 23
-1
votes
1 answer

For cycle gets stuck in Python

My code below is getting stuck on a random point: import functions from itertools import product from random import randrange values = {} tables = {} letters = "abcdefghi" nums = "123456789" for x in product(letters, nums): #unnecessary …
MasterArch
  • 63
  • 1
  • 5
-1
votes
1 answer

How to mimic while($string=~/regular_expression/g) of Perl in Ruby

I want to mimic while($string=~/($regular_expression)/g){ print $1."\n"; } of Perl in Ruby. Is there a way to do that in Ruby (e.g. print something per match)?
user3477465
  • 183
  • 2
  • 2
  • 6
-1
votes
1 answer

Tricky verification code on a form

I have an implemented control check on a form coded this way: public function checkCittaResidenza() { if (is_string($this->citta_residenza) && (strlen($this->citta_residenza) <= 45 || strlen($this->citta_residenza == 0))) { …
-1
votes
1 answer

matlab 'for' loop not executing last step or single step

I don't understand why the for cycle does not execute the last cycle, i.e. the field 'PX_TO_BOOK_RATIO'. javaaddpath('C:\DocumentsandSettings\cascari\Desktop\API\APIv3\JavaAPI\v3.7.1.1\lib\blpapi3.jar') connection =…
Giuseppe
  • 518
  • 10
  • 22
1 2 3
99
100