Questions tagged as 'c++'

2
answers

Doubt about function in C ++ that works as a destructor? [closed]

I understood all the code below but in certain part the person quotes something as a destructor? What is it? What's the use? It would be this part here: ~Vetor() { delete [] vet_pos; delete [] vet; } Why is this ~ next to...
asked by 25.10.2018 / 21:24
1
answer

Dynamic allocation giving problem in c ++

I have this problem to solve in Hacker Rank and my code for solving this problem was as follows: #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std;...
asked by 02.03.2018 / 17:24
1
answer

Binary tree printing only the left side

Hello. My binary tree is only printing the left side, what can it be? I'm using TAD to implement. Tree structure: typedef struct _no { int conteudo; struct _no *esquerda; struct _no *direita; struct _no *pai; } Arvore; In...
asked by 29.08.2018 / 00:28
1
answer

Point-to-point operation in the image

I'm trying to perform a simple sum operation that adds 30 strokes to each channel, but the program just hangs without error output (probably some type error). I got into this answer // Codigos1.cpp : define o ponto de entrada para o aplic...
asked by 19.08.2018 / 00:10
1
answer

I would like to know what is wrong with my code?

My code is a question, I'm learning to program and using the codcad site, the question is in the image. When I send my code, it only has 60 points of 100. I would like to know what I am doing wrong. Follow the image. Edit: I tried to sol...
asked by 30.03.2018 / 11:46
1
answer

Can anyone explain why this is possible? C ++

#include "stdafx.h" #include <iostream> using namespace std; class S { public: S() { } S& operator=(S&) { std::cout << "copy assignment" << std::endl; return *this; } }; int m...
asked by 07.03.2018 / 20:36
1
answer

Struct presenting problem

I am not able to compile the program has error in the declaration of the variable struct product, when I try to create an instance in main . #include <iostream> using namespace std; struct produto; int main() { produ...
asked by 12.09.2017 / 01:15
1
answer

Insert character by character of Russian alphabet into a char vector in C ++

Hello, I would like to know how to insert characters (from the manual form) of the Russian alphabet into a char vector, since I am trying to write the below and the problems in the printout. Here is the code: #include <iostream> int main...
asked by 14.08.2017 / 23:27
2
answers

Problems with function returning character vector in C ++

Follow the code: #include <iostream> char* criaVetor(){ char vetor[20]="Olá mundo!"; return vetor; } int main(){ char retorno[20]=criaVetor; std::cout << retorno; return 0; }    error: array must be i...
asked by 14.08.2017 / 16:54
1
answer

Associating stack with struct in C ++

Build the following program: #include <iostream> #include <stack> using namespace std; struct Register{ string name; int birth; char sex; void Insert(string st_name,int st_birth, char st_sex){ name=st_n...
asked by 08.07.2017 / 05:04