Questions tagged as 'array'

1
answer

Division and Conquer Algorithm

I'm having trouble getting an algorithm to divide and sum the elements of an array. public static int somatorio(int[] a, int numElem) { if(numElem == 0) { return 0; }else if(numElem == 1){ return a[0]; } int meio...
asked by 14.10.2018 / 00:59
1
answer

Mount an array with result of a foreach with php

Hello I'm not able to mount an array with results from a foreach. I have and foreach foreach($Result as $Aluno): extract($Aluno); echo '<tr>'; echo "<td class='nome'>{$Nome}</td>"; echo "<td class='c...
asked by 28.11.2018 / 21:25
1
answer

How to make calculations with elements of an array in Ruby? [closed]

numeros = [1, 2] class C def calcule_array(*numeros) puts a + b end end numeros = C.new puts numeros I would like to know how I can do calculations with integers that are inside an array in Ruby, I tried the above c...
asked by 04.11.2018 / 21:31
2
answers

When inserting into a vector always overlays the previously entered value

In my code when adding a contact (X), and seeing the list of contacts, I have contact X, but when adding another contact (Y), and go to see the list, contact Y replaces X, how can I to add multiple in the vector? #include <stdlib.h> #inc...
asked by 04.11.2018 / 23:31
1
answer

Object reference not set to an instance of an object. Array

Hi, My problem is in the array following this code: mesh meshCube; string[] file = File.ReadAllLines("object.mind"); foreach (string filetext in file) { if (filetext.Contains("v")) { string ext = filetext.Substring(filetext.Ind...
asked by 24.10.2018 / 00:21
2
answers

"Illegal string offset" error when calling usort in bank data

I am trying to sort the result by a specific column of an array of bank data. function cmp($a, $b) { return strcmp($a['usu_codigo'], $b['usu_codigo']); }; usort($usu_info_coluna, "cmp"); Giving var_dump to $usu_info_Coluna...
asked by 25.10.2018 / 14:54
1
answer

How to treat an array with N rows and transform to a list to send to C #

I'm sending an array of the angular js to the controller of C # , and I'm handling it with stringfy for json in>. In my method POST it does not receive anything, it simply returns null C # code public void Post(st...
asked by 10.08.2018 / 18:34
1
answer

Comparison of arrays or best method to add new elements

I have a webservice in json that returns me to the last people who passed in a certain place. That said, I did the following: I always ask for information about the last person to go to the api. I created in my page in setInterval...
asked by 29.08.2018 / 15:36
1
answer

Array key filled with an expression from a SQL query

What does this mean exactly? Array ( [0] => Array ( [MAX(nr_ficha)] => 13 ) ) I gave a print on the screen and saw that my foreign key (% with%) is getting value 13 (yes, that is the last value in the table), but I d...
asked by 28.08.2018 / 15:09
1
answer

Union of vectors, without repetitions in C [duplicate]

The statement follows:    Read two vectors of X and Y integers, each one with 5   elements (assume that the user does not report repeated elements).   Calculate and show the resulting vectors in each case below:       Sum of X and Y: sum...
asked by 19.07.2018 / 03:56