Questions tagged as 'array'

3
answers

How to remove the first element from a list in python?

I have the following code: At the command line > teste.py primeiro segundo In the script teste.py : import sys print(sys.argv) And I have the following return: ['c:\teste.py', 'primeiro', 'segundo'] But I would like t...
asked by 05.02.2015 / 15:21
2
answers

Generate a random profession for Online Players

I am creating a small game (Android) to play me some more friends of mine. The game is called "Cops and Thieves". At least it is necessary to have 4 players in which one of them will be the POLICE, another will be the CRIMINAL, another will be t...
asked by 23.12.2016 / 10:05
3
answers

Compiler reports error when I try to zero vector

The compilers accuse error when I try to zero a vector with the command vetor[10] = {0}; And it only accuses error in this line because I also used it in the int vetor[10] = {0} attribution and there does not acknowledge error....
asked by 24.03.2015 / 21:15
2
answers

Remove element from a vector in C # and not leave the vector with a space?

I need to remove an element from a vector with 5 elements, and can not have empty space in the vector. I need to remove by index.     
asked by 11.03.2016 / 00:00
1
answer

Insert within array whose parent property value is equal to the property value of the child object

I have an object (Questions) and I want another object (Answers) to be added to it according to a common id. var Perguntas = [ { idPergunta: 13, textoPergunta: "Qual seu nome" , Respostas : [] }, { idPergunta: 26, textoPergunta: "Qual...
asked by 06.11.2014 / 20:13
1
answer

Difference between null and clear in an ArrayList

What's the difference between: arrayList.clear(); and arrayList = null; Do not both destroy all elements of the ArrayList?     
asked by 29.08.2014 / 05:39
2
answers

Count elements in a range of values

Is there a more concise way of counting all the elements of a vector (here in the example between 10 and 20) than the one presented? vector<int> v={1,2,3,45,24,10,20,-90,100,18,17,15,87}; int n; for (int i=0;i<v.size();i++){...
asked by 16.12.2015 / 10:54
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
2
answers

Why does the char * argv [] statement work in the main arg, but not in the code body?

Because when I use the char *argv[] statement in int main(int argc,char *argv[]) it works, but when I try to use it inside the code body with char *argv[]; does it not work? The error below is returned at the console when...
asked by 18.07.2016 / 21:12
3
answers

How to create an array inside another array with jQuery

I'm trying to create a array in jQuery using the .push () function where each element should contain another array inside it. The framework I need to create is this: array( 'elemento1' => array( 'elemento1...
asked by 15.05.2015 / 20:22