Category "for-loop"

Trouble with JavaScript 2D array and nested loop

Will you please explain what I'm missing? And possibly what I can do to fix it. I'm receiving the error: TypeError: Cannot set properties of undefined (setting

how to make repetitive request of the input?

I write this code to get the of digit of the number inputted by the user the problem I don't know how to make it repetitive to user to get the request of enteri

Why cant you subract a value from a for loop within an 2DArray but works vice versa(Adding a value to the 2DArray)?

Just like the game minesweeper I want the "O"s to change to "1"s if the borders are next to the "X"s, the board[i][j] will only change to "1"s if and only you a

How to find a missing value in an array? [duplicate]

I am trying to find the smallest missing element of an array using function check, which has two arguments (n and array A). I can't understand

Concatenating the output of a for loop

Y= zeros(3, 354) for m = 1 : 118 R=GridData.R2(:,3*m-2:3*m); X=GridData.X2(:,3*m-2:3*m); B=GridData.B1(:,3*m-2:3*m); G=GridD

Transform JSON into required format

Here is my input JSON [ { "date": { "value": "2022-05-01" }, "parent": { "value":

How to create a mosaic from different shapefile in R?

I have 37 shapefiles with different names.Individually each of them represent a different part of a country. I would like to create a mosaic of my 37 shp to jus

opencv bot Recursion Error using pyautogui , python-imagesearch, cv2

Im writing a bot using cv2 , pyautogui,and imagesearch libaries. in this function im searching for an image then I'm going to run another function when found if

Add word using sed to the last column of csv

I tried the following sed and even I have set $ to set the path at the end it doesn't seem to be working. Also I dont know if there's any way of execute this li

find elements of an array in another array, why do I have this error?

I was trying to visualize the algorithm of this exercise, but I'm having a lot of problems. the exercise asks to implement this function: extern const void *mem

Deleting node in list

*x = L->list[i]; /* Save the deleted element to parameter x */ for(j = i+1; j <= L->size-1; j++) L->list[i] = L->list[i+1]; L->size--;

Iterating through list of lists of lists

I am trying to iterate through a 3-D list in python(not numpy but I am willing to convert to a numpy array if this makes it easier) in such a way that from a li

What does the specified number 1 in this code mean?

for (i in 1:25) { pid.means[,i] = apply(get(paste("pid.tf",i,sep="")), 1, mean, na.rm = TRUE) } I understand the function of this for loop, but i can't fin

Creating Static Meshes in For Loop using C++ with unreal engine

this is the fix at top use this to create a string that Static Mesh Object can accept as a unique identifier so the engine doesn't crash FName name = *FString::

Print elements from an array [duplicate]

I am very new to C++ , and I am wandering why this code: void display(int display[]){ for(int i=0;i<sizeof(display)/sizeof(int);i++){

Loop through an array of objects to get the specific value that is highlighted in below image

Loop through an array of objects to get the specific value that is highlighted in below image https://i.stack.imgur.com/EYfzT.png

Reuse a method with nested for-loops that only differs by some lines inside the inner loop

I have a java method that basically looks like this: public static Map<String, List<MyObject>> myMappingMethod(List<A> listOfA, List<B>

How to iterate in a range determined by TWO variables?

I have a code: echo "the range's starting number:" read -r a #it was 10 echo "the range's ending number:" read -r b #it was 20 for (( c=$a; c<=$b; c++ )) do

How can I skip loop for first and last element of array and set them to constant value?

I would like the loop to start from the second element and to end before the last one. So that I can set the first and last one to constant value. for (int i =

how to print the sum of all the inputs?

I wanted to take two numbers as an input 5 times and then print out all their sum. it would look like enter two numbers:3 4 enter two numbers:3 5 enter two nu