Questions tagged as 'for'

2
answers

Access items from a stack using for

I'm trying to access a position forward in the stack to make a comparison, but it's not working and I could not understand this for . Code for ( String UmToken : PilhaTokens) { System.out.println(UmToken); } Comparison I wante...
asked by 08.04.2016 / 22:27
3
answers

Why does the first element of the vector go out as zero without having saved that value there?

Why does the following code print a 0 at the beginning of output ? #include <stdio.h> #include <limits.h> // Escreva um programa que leia do teclado 8 valores, e em seguida os // imprima em ordem inversa....
asked by 12.10.2018 / 23:20
1
answer

Value comparison within date frame

Hello, I have a database, with about 50000 observation, as follows, just figurative values: nome<-c("joão","pedro", "joãoo") identificador<-c(123456,124578,123456) valor<-c(2145,350,23) dados=data.frame(nome,identificador,valor) I...
asked by 14.03.2017 / 20:38
1
answer

How do I make the next loop perform?

I have a list with two or more Strings: [Panel, Control] Now comes the problem: for (int i = 0; i < lista.size(); i++){ String linha = ""; while ((linha = leitura.readLine()) != null){ if (linha.contaens(lista.get(i)))...
asked by 25.03.2016 / 07:14
1
answer

Temporary variable performance within loop

During college a teacher commented to me that declaring a variable before a loop and reusing it was an economical and more interesting way to do it. For example (in Java): String str; for(Pessoa p : pessoas){ str = p.getNome();...
asked by 13.06.2017 / 22:21
1
answer

End loop when typing specific character

Hello! I need to resolve the following question, but I can not. Write an algorithm that computes the mean arithmetic of the students' 3 grades (number indeterminate number of students) of a class. O algorithm should read, in addition to the n...
asked by 19.09.2015 / 23:53
1
answer

Difference in performance for simple and for iterator

I have a list of clients and on a certain screen the user can search and edit the clients of the list that is very extensive, comparing these two examples what would be the best to work? Example 1: for (int i = 0, tamI = listAll.size(); i&l...
asked by 23.08.2017 / 15:45
1
answer

How to swap an apply within a for by a double apply?

I have a origem vector and a destino vector with several locations in latitude and longitude. For each location in origem , I want to count how many places in destino are located within a radius of up to 2km, so I d...
asked by 18.01.2017 / 01:16
3
answers

Error in variable declaration in loop

I made the following command: for(int i = 1 ; i <= 3 ; i++) {etc } So I gave the following error when I compiled: game.c:11:2: error: "for" loop initial declarations are only allowed in C99 mode for(int i = 1 ; i <= 3 ; i++) { /\ //...
asked by 18.09.2015 / 01:14
1
answer

Does a 'break' within two 'for' actually work as a continue?

If by chance I have break within two for , as in the example below: for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) { break; } { break will not cause the program to exit the two for...
asked by 10.11.2015 / 05:52