Most voted "array" questions
An array (array, vector, or matrix) is an ordered data structure representing a collection of elements (values or variables), each identified by one or multiple indices.
Learn more…3,046 questions
Sort by count of
-
1
votes0
answers42
viewsIs it possible to make an array of arrays?
In a 3-column datagridview I need to scan all n rows and save them all in an array (or any collection) where each index contains the information for each datagrid row. Something like: meArray[line1,…
-
1
votes1
answer515
viewsGroup hashes by Ruby value and manipulate them
I have this hashed array that I’ve simplified to get smaller. My goal is to join by marca of carros to make a small report showing how much that marca is making a profit based on compras. Notice…
-
1
votes1
answer39
viewsInvert PHP Xml view
How do I invert the display of an xml in PHP? Code: $xml = simplexml_load_file('link.xml'); foreach($xml->VERSAO as $versao) { ?> <tr> <td width="10%"><center> <?php echo…
-
1
votes2
answers426
viewsExtract a new array from an array - Ruby
I have the following exit: => [ [ 0] [ [0] "CELULA", [1] "LENNA ", [4] "jul 01", [5] " 2015 12:00:00 AM", [6] "N", ], [ 1] [ [0] "CELULA", [1] "ARI [4] "jul 01", [5] " 2015 12:00:00 AM", [6] "P",…
-
1
votes1
answer180
viewsHow to complement these queries to get the buyer’s data in the bank?
I made these queries below to get the data from the buyer’s database and the products he bought. With the first query, I got the ID and with these IDS I made a new foreach that took the products…
-
1
votes2
answers554
viewsTaking information from a select and passing an array
I want to take all the fields of one select and store them in a array. I thought I’d do it this way, but it didn’t work. var lista = []; lista = $('#Model').text(); $('#Model').append('<option…
-
1
votes1
answer477
viewsHow to increment the index of an unlimited array?
How can I increment an array within a structure? This is my structure: struct list { char name[50]; int products_list[]; } LIST[10]; I wanted to know the current number of elements in the array…
-
1
votes1
answer802
viewsPass array as parameter
I have a question about arrays. So I have the following code: public static void main(String[] args) { //Objetos..... ColeçãoCidades ListaCidades = new ColeçãoCidades(); //Adicionar regiões Scanner…
-
1
votes2
answers955
viewsHow to print the day numbers of each month using Array, String and byte?
I’m trying this code, but it doesn’t work. public class MesDias { public static void main(String[] args) { // Array String byte String Mes = {Jan, Fev, Mar, Abr, Mai, Jun, Jul, Ago, Set, Out, Nov,…
-
1
votes1
answer62
viewsAdd item with different array
I have the following array() Array ( [nome_responsavel] => [telefone] => [email] => [dependentenome] => Array ( [0] => qqq [1] => qqq [2] => qqqq ) [dependentedata] => Array…
-
1
votes2
answers63
viewsIs it possible to improve the writing of this code?
I have the following code below: memo1.Lines.Add('def' + ' ' + nome + ' ' + '('+ variavel1 +',' + ' '+ variavel2 + ',' + ' ' + raster1 + ')' +':'); Which results in something like this: def nome…
-
1
votes1
answer627
viewsVariable inside an array does not work
is a CLOUDINARY image upload system. When I use a fixed value for PUBLIC_ID, it works! $files["remote"] = \Cloudinary\Uploader::upload($sample_paths["couple"], array_merge($default_upload_options,…
-
1
votes1
answer276
viewsProblem printing the contents of a vector
How to make a score accumulator for each answer. package modulo02; import java.util.Scanner; public class vetorGabarito { public static void main(String[] args) { int pontuacao = 0, n, i, j = 0;…
-
1
votes1
answer119
viewsError reading and comparing matrix numbers
The program must read a number and compare with the numbers of any 3x3 matrix if the number belongs to a column of the matrix it must print the position, when type 1 it prints two positions, but 1…
-
1
votes2
answers1024
viewsHow to find the size of a character array?
#include <iostream> #include <string> #include <locale.h> #include <stdio.h> using std::cout; using std::cin; using std::endl; using std::string; int main(){…
-
1
votes2
answers938
viewsPush in JSON Object Angularjs
How do I add 1 item to a json object in Angularjs. In case I have: {COD: 29, MOTIVO: "teste"} And I’d like you to stay: {COD: 29, MOTIVO: "teste", ID : 12345789} I tried it this way:…
-
1
votes2
answers13508
viewsHow to pass numbers to alphabet letters
Converts Numbers from 1 ao 26 for A - Z of the Alphabet. I have a directory with several files and wanted to do a "FOR" for, ... the name(file). I’m doing this with files named by ordinal numbers,…
-
1
votes1
answer301
viewsShow typed string string
How to show read values inside a repeat loop in Java? Ex: for(int i = 1; i <= 2; i++){ System.out.print("Nome: "); String nome = tecla.nextLine(); } ?? <- Make the read names appear here…
-
1
votes1
answer1179
viewsHow do I sort string in the Insertion Sort method?
I’m with the following method, but in the WHILE line it’s error. netbeans says "bad operand types for Binary Operator "&&", first type: Boolean, Second type: int". public boolean…
-
1
votes1
answer684
viewsHow to transform an array from one dimension to two in Java?
I have an array of one-dimensional integers, like this: int[] a = new int[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}; And I want to turn it into a two-dimensional array, for example: [1, 2, 3], [4, 5,…
-
1
votes3
answers361
viewsAttempt to manipulate values of a vector generated by a JSON
I am trying to "change" values of a vector received from the consumption of a JSON. My logic was to create a for to traverse the vector, parse the item on that partition and rewrite into a copy…
-
1
votes3
answers730
viewsInsert data into a vector to then print and multiply
Write an algorithm that reads two vectors of 10 positions and make the multiplication of the elements of the same index, placing the result in a third vector. Show the resulting vector. I wanted to…
-
1
votes2
answers673
viewsPHP: Txt for Array relating lines.
next, I have a text file (.txt) with the following structure: |100|Nome do Cliente| |200|Produto 1|R$100| |200|Produto 2|R$200| |200|Produto 3|R$300| In short, whenever the line starts with |100|,…
-
1
votes2
answers3885
viewsExtract JSON object item with Angular.js
I have an Angular application that uses the Google Maps API to search for latitude and longitude, but I’m not getting the latitude and longitude separately. My application works as follows, the user…
-
1
votes1
answer102
viewsRecursion and sum
I am making a program in which you need a recursion according to the exercise that sums a vector of two matrices and sums the rows after the recursion and then add the columns to my code #include…
-
1
votes2
answers2427
viewsExclude element from an array
Need to delete the first element of an array. Have: Numero[10]. How do I delete the value in Numero[0] and overwrite the other elements?
-
1
votes1
answer99
viewsPHP Arrays and Strings Interface
Situation I have a page in PHP that does CNPJ searches and returns the values, but as it is without any formatting the results appear in forms of ARRAY and STRINGS. Example array(23) { [0]=>…
-
1
votes2
answers83
viewsScreen to enter values
I have this code and I would like to create a screen for the user to enter values and they are inserted in their answers arrays, CREDITO (array a) and DEBITO (array b) and create a button to run the…
-
1
votes2
answers283
viewsArray ordering based on the order of another array
Next, I have two vectors each with a numerical sequence. Let’s call them Array1 and Array2. The values are below... Array1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; Array2 = [7, 6, 3, 9, 4, 5, 1, 10, 8,…
-
1
votes1
answer252
viewsWorking with Generics
First, the task: Create a new Map class, now using the name Sortedmap. It should have the same methods as the Map class of the previous task, and accept as type Key a type K that implements the…
-
1
votes2
answers43
viewsProblems with Jquery selectors
My problem is this, I have this code: <script language="javascript"> $(document).ready(function(){ $('#simular').each(function(){ $(this).click(function(){…
-
1
votes2
answers897
viewsHow to delete an element from an Array String?
I’m having the following build error: del(alimentos[i]) TypeError: 'str' object doesn't support item deletion What did I do wrong? I would like to remove the typed item from the list. My code: dieta…
-
1
votes0
answers37
viewsRead string explicitly as an Array - PHP
Next I need to transform the string below into a multidimensional vector: $tesste = "[ ['Faturamento', 32000, '2017-05-23',[ 'Tes-OBI' => 'TESTE']],['Faturamento', 50000, '2017-05-24',[ 'Tes-OBI'…
-
1
votes4
answers8205
viewsHow to get the highest value of a python array / vector?
how do I get the highest value of a matrix or vector? For example, in this exercise I have to make a 4x4 matrix and return to row and column of the largest element, but I stopped there. m = [] for i…
-
1
votes1
answer182
viewsWhy does Netbeans suggest changing an array addition?
I am starting my studies in programming with Java. I am creating a class for object in Netbeans that warns the following message: Array concatenated with String Why? My code: import…
-
1
votes1
answer348
viewsHow do I edit an element of this array?
I have an array this way: List<dynamic> business_list = new List<dynamic>(); business_list.Add(new { business_Name = reader.GetString("name"), business_OwnerID =…
-
1
votes1
answer403
viewsDoubt about changing data in java arrays
I have an array of the Person class called vector. I already populated the vector with instances of named persons of p1. My question is how to change the value of p1 when you’re inside the array:…
-
1
votes1
answer239
viewsHow to create property for an Array? VB.NET
I have a question in Arrays, I do not know if I wrote right if what I am referring is really a property, I will explain in detail what I want to do. For example: I want to create an array with…
-
1
votes3
answers97
viewsProblem trying to get value from an array
I’m trying to work with an array I receive by POST, but I’m not getting the values contained within the array. When I give print_r($_POST) get: Array ( [access] => Array ( ['Kminput'] => 1000…
-
1
votes1
answer118
viewsGeneric vector with error
I’m concluding this generic vector activity, but I’m having trouble returning the last and first element of the list. and to remove the element. public class Vetor<T>{ T[] vetor; int…
-
1
votes2
answers2820
viewsHow to generate an array using Random to assign values, but make it never repeat values?
I’m working on a Bingo in C# for a facul work and need to make a vector of so many values and make it never repeat this values, I am using the following procedure to generate the values of draw ↓…
-
1
votes1
answer801
viewsInsert an element into an array that contains an object
Hello, I would like to know how to insert an element inside an object of an array, in this case, when I add with the code below, the element is inserted as another index: this.array = [];…
-
1
votes2
answers413
viewsReverse
package pag1; import java.util.Arrays; import java.util.Scanner; public class ex3 { public static void main (String[] args){ Scanner x = new Scanner (System.in); int posicao = 0; int[] numeros = new…
-
1
votes2
answers71
viewsObjects em javascript
I’m having some problems with Objects while using them in Node js , I need an object like this : var clients = {}; var user = { [client.id] : { 'nome': 'osvaldo', 'sala': 'B1' } };…
-
1
votes2
answers233
viewsproblems with string and split C#
I have the following function: string str = "1 2 3 4 5"; //string para separar string[] ArrayValor = str.Split(" "); //nesse caso o array seria {"1","2","3","4","5"} but wanted something more…
-
1
votes1
answer43
viewsError declaring a matrix
I made a matrix[day][time], but I get error when initializing it. I get that mistake and I don’t know how to fix it error: expected ':', ',', ';', '}' or 'attribute' before '=' token The code is…
-
1
votes1
answer76
viewsMount array with users Permissions
I need to mount an array in PHP (LARAVEL) and I’m not finding a way to do. I have a user system with roles and Permissions. When I view the user, I list all the Permissions, but one below the other.…
-
1
votes0
answers40
viewsIs it possible to fill a tree list in reverse using stream?
The point is this My class public class Node{ private String name; private Node parent; private List<Node> children; public Node() { } public Node(String name) { this.name = name; } public…
-
1
votes1
answer248
viewsWhat is the reason why a vector with no set size does not work?
If you create a vector: Thus int Vetor[0]; works #include <iostream> using namespace std; int main() { int vetor [1]; vetor[0] = 12; cout << vetor[0] << endl; } Thus int Vetor[];…
-
1
votes2
answers77
viewsWhat was my mistake with that code?
Hello, I’m starting to study the JS language and I stopped here, I don’t know what my mistake, someone could explain to me what I’m doing wrong? <!DOCTYPE html> <html> <head>…