Questions tagged as 'array'

2
answers

Adding value from an array

I need to do the sum of values provided by an array. The array comes from a select in the database. The array looks like this: Array ( [0] => Array ( [valorPagamento] => 12 ) [1] => Array ( [valorPagamento] =>...
asked by 20.03.2016 / 21:00
1
answer

Check data before using as array element

In chat was asked something about data entry validation to avoid catch error out of range allowed. I found the question interesting and pity that was not posted here, I am posting: public static T[] ReplaceRange<T>(this T[]input, T[] r...
asked by 13.07.2018 / 17:29
2
answers

Print components from an array in reverse order

I wrote a code to print the components of an array in reverse order. However, it only returns 5 or 6 numbers (at most), even though I have put more numbers in it. #include <iostream> using namespace std; int main() { int i;...
asked by 29.09.2017 / 16:04
3
answers

How to insert a new value into an array without duplicating through the switch case? [closed]

One of my attempts so far has been: array = [1, 2, 4, 5]; definir = function() { switch (array) { case (array > 1): array.push(1); break; case (array > 2): array.pu...
asked by 11.02.2017 / 15:34
1
answer

Array Split twice Python

I need to get coordenadas cartesianas and separate them, so that you know which pair is ordered. I get a string where the points come this way: x0,y0 x1,y1 ... xn,yn I used a% w / o for space first and then an array for comm...
asked by 04.10.2018 / 05:54
1
answer

Problem with Struct

I have the following error in my code:    error: request for member 'media' in 'given', wich is of non-class type   'DataAluno [5]' Code: #include <iostream> using namespace std; struct DadosAluno{ int idade[5]; f...
asked by 13.02.2015 / 06:33
2
answers

Background Dynamic URL

It is possible to create a dynamic array of images and it is called inside the background-image: url ()? With the hint that was passed by @hugocsl earlier, I would like to reuse this statement line because it is part of a page loader that I u...
asked by 26.04.2018 / 23:11
3
answers

array in a php foreach

I will try to be objective in the doubt: I have the following code: <?php foreach ($modelo as $k => $v) { $sql_ = "SELECT * FROM pedido WHERE modelo LIKE '%".$v."%' ORDER BY id ASC"; $disp_sql_ = $mysqli->query($sql_);...
asked by 25.09.2018 / 19:23
2
answers

How to get object position (index)

How to get the position of the object that was found in $ .inArray ()? var obj = [ { cidade : [ { nome : "Maringá" , uf : "PR" , } , { nome :...
asked by 10.12.2014 / 14:27
2
answers

Find out if it is even or odd in array

I'm trying to set the even and odd numbers of a total of 5 numbers entered by the user into a vector. int[] atividade = new int[6]; for (int i = 1; i < 6; i++) { Console.WriteLine("Insira o " + i + "° num...
asked by 20.08.2017 / 04:37