Questions tagged as 'array'

2
answers

How to subtract first value with last value in array [PHP]

I'm starting with PHP and I have to do this exercise: As a data I can not use php functions The exercise consists of entering a number through a form, this number indicates the length of the array and filling the array with random numbers. On...
asked by 25.11.2018 / 19:02
1
answer

C ++ fix problem

I am entering by passing a char to an array of char and when inserting it does it well, as I enter and print everything from little to little. Then I made another for to show only the arrangement and it turns out that onl...
asked by 02.11.2018 / 21:18
3
answers

How to look up value in an array without a cycle

I do not have much experience in c ++ and I have the following question: I have an array / vector of N elements, and I have to enter it into a while condition to check if any of its elements equals a constant number k, but the idea is that every...
asked by 13.10.2018 / 01:19
2
answers

Create an array that does not repeat words C ++ strings

I'm doing a program in C ++ that takes words from a .txt file and inserts each one into an array, the problem is that you should NOT repeat any word, and I'm having complications in that part. Currently I'm only working in that part, the menu on...
asked by 13.11.2018 / 05:52
2
answers

How do I decompose a number in an array in c ++?

I made a program that decomposed a number entered an arrangement as long as it was static, it is this: #include<stdio.h> #include<stdlib.h> #include<iostream> #include<string> using namespace std; int main(){ int nu...
asked by 02.10.2018 / 20:53
1
answer

Problem with array in PHP

I have a problem using array. I am trying to add the average score of 'persona1'+'persona2' and divide the result by the number of people so that I can print the average number of notes between these two people. But, the result is not wh...
asked by 30.11.2018 / 20:35
1
answer

Find values in a VB array

I'm doing a task to find data in an array, in this example I have an array with values 01, 02, and 03. What I do is put a value in a text box and in a FindKey function, indicate whether that value exists in the array. I do not know how I co...
asked by 19.06.2018 / 01:30
2
answers

How to reorder this array?

I have the following array: $array_atual = array ( 'id_item' => array('1', '3'), // 'id_item', 'id_item' 'cantidad' => array('15', '10') // 'cantidad', 'cantidad' ); I would like to know how I could leave it in the following w...
asked by 10.06.2018 / 13:27
2
answers

Pass an array to objects in php

foreach ($video_filer['items'] as $video) { if (isset($video['id'])) { $date = new DateTime($video['snippet']['publishedAt']); $time = covtime($video['contentDetails']['duration']); //convert the date $video_da...
asked by 12.04.2018 / 06:09
1
answer

Delete repeated elements from a collection of objects

I got this product sales collection: $ventas = VentasProductos::withCount('producto') ->orderBy('producto_count', 'desc') ->take(5) ->get(); but in the view it...
asked by 12.04.2018 / 22:32