Questions tagged as 'array'

1
answer

How to pass an integer with two digits, causing each digit to be in a position in the vector?

I make the sum of two numbers 5 and 5, how to pass the result (10) as follows : vetor[0]=1 and vetor[1]=0 , ie separate result for each position of my vector, without the vetor[0] receiving the full value that would be ve...
asked by 08.06.2016 / 03:42
2
answers

How to avoid array overflow in C ++?

My program was showing strange behavior, until I discovered that there was an overflow of array , for example: int arr[3]; for (int i = 0; i<10; i++) { arr[i]=i; cout << arr[i]; } In this light example, i exceeds th...
asked by 12.05.2018 / 15:26
1
answer

Help to populate an array with objects using a while

I want to read rows from a SQL and use them to create objects and finally put these objects in an array. But in the end my methods (of the class Object) do not print the name of the object. The code to read only one line works, so the problem i...
asked by 27.11.2016 / 20:54
1
answer

Error accessing string vector

I have the following code: #include <stdio.h> #include<stdlib.h> #include<string.h> int main() { char v[]= {'Brasil', 'Alemanha', Japão'}; int i = 0; for (i=0; i<4; i++){ printf("%s", v[i]); } } Ho...
asked by 30.10.2016 / 01:23
4
answers

Transform multiple arrays into one array

In a given process in my system, I get a array of characteristics as a return from a function, and this array can contain several information, including other arrays with different names for each type of information....
asked by 03.11.2016 / 11:52
2
answers

How to pass numbers to alphabet letters

Converts numbers from 1 ao 26 to A - Z of the Alphabet. I have a directory with several files and I wanted to make a "FOR" for, ... the name (file). I'm doing this with files named by ordinal numbers, but I'd like to do this with f...
asked by 27.02.2016 / 02:19
2
answers

Problem in storing data in Array

I'm creating a program that stores a person's tasks in an array, and shows them those tasks. But I have trouble showing tasks. I can not show the old jobs. Only the last task entered is displayed. Code: <?php session_start(); ?> <h...
asked by 21.07.2016 / 04:31
2
answers

First item returns undefined

I'm trying to print a split , but after passing for , the first value returns as undefined , could you tell me what it could be? function parteTexto() { var teste; var texto = document.getElementById("caixa").value;...
asked by 23.09.2017 / 04:28
1
answer

How to use foreach with this type of JSON (PHP)

I'm trying to display the values of a JSON with PHP most unsuccessfully. Used Code: JSON { "friendslist": { "friends": [ { "steamid": "76561197960265731", "relationship": "friend",...
asked by 29.12.2015 / 20:53
1
answer

How to check the presence of certain values in an array?

I have the variable $search_dorms that returns me Array ( [0] => 1 [1] => 2 ) . It can also return Array ( [0] => 1 [1] => 2 [2] => 3 ) Or simply Array ( [0] => 1 ) I'm trying to check the re...
asked by 03.01.2016 / 19:23