Questions tagged as 'c++'

2
answers

passing objects as parameters in c ++

Hello, I would like to know how to pass an object created in c ++ as a parameter to a function of another object, I saw the forum in English, but I did not understand very well how it does, if anyone can help me, > classes that I'm using in th...
asked by 14.09.2016 / 22:19
1
answer

Private variable error in C ++

I can not understand why I'm giving this error while compiling my code:    Include file from test_GenericArray.cpp: 2: 0: GenericArray.h: In   function 'std :: ostream & operator < < (std :: ostream & const   GenericArray &: ':...
asked by 20.03.2016 / 03:57
1
answer

Could you help me with MergeSort?

I'm having trouble compiling the MergeSort sorting method. #include <stdio.h> #define TAM 10 void intercalar(int vet[],int aux[],int ini1, int ini2,int fim2) { int in1=ini1,in2=ini2,fim1=in2-1,au=0,i; while(in1<=fim1 &&am...
asked by 15.11.2016 / 05:58
1
answer

How to perform a vertical bar chart with the # character in c ++?

Performing a C ++ job here from college: How to make a vertical graph in bars, that is, from bottom to top, of some vector. Assuming there is a vector with some positions, for example v [3], where each position is a user that contains a va...
asked by 29.04.2014 / 23:52
1
answer

Auto benchmarking with moon

A script in C or C ++ could write algorithms on Lua (by brute force , that is, test several possible combinations) based on a database with algorithm results. The idea is to arrive at the most efficient algorithm for a given goal, for exampl...
asked by 02.07.2014 / 00:27
1
answer

Declare MAP already passing values in C ++?

Good luck, I see that with the array I can do this: int array[]= {5,6,4,2}; My question is, in the language C ++ I can declare the map already passing values? Example: map<string,int> mymap = { "a",1};     
asked by 08.08.2018 / 22:53
1
answer

String parse separated by null values

I'm using OpenFileName of winapi with the flag of multiselect. When the user selects multiple files it returns me a string separated by nulls as follows: "[caminho da pasta]"[caminho da pasta]%pre%[arquivo 1]%pre%[arquivo 2]%pre%[arquiv...
asked by 28.05.2014 / 16:53
1
answer

Problem with File Recording txt in C ++

When I try to write something new in this file, it deletes what was saved before, is always saving on what it had before, can anyone tell me what it is? arquivo = fopen("dados.txt","w"); aux = x.retorne_energia(); aux2 = x.retorna_nome(...
asked by 15.06.2014 / 18:16
1
answer

Take number by number of a sequence of numbers to compare them

My teacher of algorithms and programming techniques spent an exercise in which a = "123567348" and of that I would say which numbers are even and which are prime. He said he would have to use substr() , and passed an example: #inc...
asked by 15.10.2018 / 22:57
2
answers

Know if value is in array without equality comparison!

I have the following code in C ++: #include <iostream> using namespace std; int main (void){ int e[5] = {10,20,30,40,50}; for (int i = 0; i <= 99; i++){ if ( i in e ) cout <<...
asked by 17.10.2018 / 13:58