Questions tagged as 'for'

1
answer

Tie is in Java

I need to receive a number n and then repeat the receipt and processing of the string v, n times. I tried the following: import java.util.Scanner; public class Main { public static void main(String []args){ Scanner sc = new Sca...
asked by 27.06.2016 / 20:56
0
answers

Vector Indexing in C

I have this function that is called through a menu of options: char cad_cliente()//cadastro de clientes { char resp;//variavel de resposta se cpf invalido system("cls");//limpa tela for(int c = 0; c < MAX ; c++)//para a primeira inform...
asked by 14.05.2016 / 21:25
0
answers

Retrieve FOR loop variable inside a FOREACH - php

Hi, I have two links in the structure of my code. The first is a FOR that mounts an array with data. And I have a foreach that traverses some DB data. I want to use the variable that returns in FOR and use in foreach, but it does not seem to...
asked by 16.12.2015 / 11:57
2
answers

Loop between an existing loop SimpleXML Photo Tag

How do I convert this (which only brings me the first photo) //corrige foto $enderecofoto = $xml->imovel[$i]->fotos->foto; $nomeeextensao = preg_replace("(^.*\/(.*)\$)", "$1$2",$enderecofoto); $removenomeeextensao = str_replace($nomee...
asked by 25.08.2015 / 21:50
0
answers

Change-making algorithm - Less amount of possible coins

Given the Change-Making algorithm: change(C1, C2, ...., Cr: valores de denominações de moedas, onde C1 > C2 > ... > Cr; n: inteiro positivo) for i := 1 para r di := 0 {di conta a denominação das moedas Ci usadas} while n...
asked by 15.09.2015 / 22:48
1
answer

Make a subset with the same condition in different bases in the R

I want to apply the same condition of subset to different bases in R. I thought for would solve, but I did not succeed. Follow the programming used: for(i in c("mar16", "jun16", "set16", "dez16", "mar17")){ postos[i]<-subs...
asked by 09.08.2017 / 16:29
4
answers

How to update an element with JavaScript [duplicate]

I have this code: let inicial = -0; const numeros = [1,2,3,4,5,6,7,8,9,10]; function proximo (){ inicial++ document.getElementById("lugar").innerHTML='' alert(inicial) for(let i = inicial-1; i...
asked by 20.02.2018 / 19:33
2
answers

Is there any alternative to using for in php? [closed]

Is there any way to do in php what for does, differently? An alternative method for example, but with the same result you would get when using for . Example of using for : for($contador = 0; $contador < 10; $contador++...
asked by 03.05.2018 / 22:23
1
answer

Why are the characters in the string being printed as integers?

I have to parse an excerpt of code and explain its operation, but I can not figure out the output: Code: word_norm = 'mundo'.encode("utf8").lower() for idx, value in enumerate(word_norm): print(idx, value); Output 0 109 1 117 2 11...
asked by 31.01.2018 / 22:03
1
answer

How to make two loops for the same code only go varying the columns of the courses and the columns of the questions?

I have a date.frame with many codes in the rows and many columns of questions, I'm making the simple frequency of each question would like to know how to vary the courses and questions at once, without having to manually repeat the code I gene...
asked by 09.06.2018 / 17:14