Questions tagged as 'array'

1
answer

In the pairstring vector, int: When adding a new string, check if a future string has the same value as a string already added

And if you have, change the value of the previously added pair instead of adding a new pair. So, I would like to add string, int pairs into a vector, except that, to avoid redundant pairs, check if the string already exists and instead of add...
asked by 09.03.2018 / 00:47
1
answer

Count items with a certain extension within an array in PHP

Hello, good morning! It's OK?   I need to mount a media gallery for a certain image extension ('.jpg') and I am having difficulty counting the files ($ key) in the value field (ds_midia_link).   How should I proceed? Thank you in advance,...
asked by 08.12.2017 / 13:49
2
answers

Return JSON php TRUE or FALSE

Good morning, I'd like my JSON filtering to look also if what I searched for indicates "true" or "false." I use this array to search the file: <?php session_start(); error_reporting(0); //função para filtrar os anúncios function filtroAn...
asked by 30.07.2018 / 16:39
1
answer

Problem with fscanf

Good evening! I have a question on my second fscanf from PATIENTS, because I wanted to save the date that appears in the text file (the day in a-> h.d_day, the month in a-> h.d_mes and the year in a-> h.d_ano), but random numbers are appe...
asked by 08.08.2017 / 00:13
1
answer

Error displaying value

I'm creating a list of contacts in php, and when I'm uploaded all the form data for it to display for me, it displayed: 1, not my data I entered. <?php session_start(); ?> <!DOCTYPE html> <html> <head> <title>...
asked by 06.09.2017 / 02:15
1
answer

Move the highest value of an Array to the end of it. [duplicate]

I need to create a method that takes the highest value of an Array and passes it to the end of that Array so that the array is sorted without losing any value. I've tried it in many ways and still can not. Please correct my code. My code:...
asked by 18.04.2018 / 19:24
1
answer

Return values from a column of table X that has 1 code in common

I need to solve a problem. I have a table of responses of a poll where the answers made with checkboxes are in different lines with a common code, that of the question answered, example: cod_questao = 100 / cod_responses = 200                   ...
asked by 01.02.2017 / 18:15
1
answer

Result 0.0 - even with typecast or swapping variable types

I have this method in the secondary class to calculate the median of a vector: public class Funcoes { .... public void setMediana(int[] valores) { double med; Arrays.sort(valores); int meio = valores.length / 2;...
asked by 02.11.2017 / 17:17
1
answer

How do I add or remove a vector element?

From a vector, how do I remove or add an element?     
asked by 17.05.2016 / 12:45
1
answer

Go through an array and separate the names to make the appropriate changes

I need to loop through an array that has the following elements: $MeuArray = array("PEDRO" ,"PEDRO" ,"PEDRO" ,"PEDRO" ,"JOAO" ,"JOAO", "JOAO", "JOAO"); I need to separate by the same names, for example: I want to get the names that are equa...
asked by 19.04.2016 / 15:43