Questions tagged as 'c++'

1
answer

Encryption does not read spaces [duplicate]

Well, I'm trying to encrypt a text file with the following "program": #include <iostream> #include <fstream> using namespace std; void writeFile(char* filename, string str){ ofstream f(filename); f << str; } strin...
asked by 30.04.2015 / 12:14
1
answer

The program jumps a line of code forward

When I run the program below, it does not prompt me for the name of the malfunction and jumps right to the description. void gestor::addavaria() { setlocale(LC_ALL, "portuguese"); int opc; string descricao; string nome;...
asked by 02.10.2015 / 17:25
1
answer

Why in set methods in C ++ do I have to use the parameter as a reference?

I have taken this class Pessoa as an example: public class Pessoa{ private: string nome; public: string getNome(); void setNome(const string &nome); }; My question is: why should I use a parameter by reference in...
asked by 28.08.2016 / 01:02
1
answer

Get open window headings

I have a program in C ++ that comes to a certain extent that I need to check if a window is open, if it does execute a part of the code. How could I get the windows open and do this check?    I found a link that could help with this, the l...
asked by 05.12.2014 / 14:27
1
answer

How to do sorting in classes?

The funny thing is that this was an answer! The problem I have is this: I have a Person class, which is initialized with a string, and it splits into a number and another string. After the class is mounted, I get an entire file and split it into...
asked by 30.03.2014 / 04:02
1
answer

Background and icon in tableView

I'd like to know how do I add a tableView to the background and icone property? I can already add the Background is now missing the icon. Code: class tableView : public QSqlTableModel { Q_OBJECT pub...
asked by 27.03.2014 / 02:30
1
answer

Vector struct and pointers

I have to get data (name and phone) from some people in a struct , then store them in a vector, all by a function / procedure. At the time of printing some strange characters come out. I'm using the C ++ DEV platform # include <std...
asked by 15.10.2014 / 23:51
1
answer

Select notes to be printed

I need to print only those annotations above > = 6, where in the code do I put if or some other statement? I tried and could not find the right place. #include <iostream> #include <string.h> using namespace std; #defi...
asked by 20.10.2014 / 20:00
1
answer

Move square with mouse only in vector X or Y

I'm learning about QgraphicsScene , QgraphicsItem I'm trying to move two squares with the mouse in the window, however moving only in vector X or only in vector Y, but they only move in one vector at a time as if are tied to move on...
asked by 17.10.2014 / 21:49
1
answer

What is the difference between "string_view" for "string" and which one should you prefer?

What's the difference between the new C ++ class and 17 string_view for string ? In what situations is the use of string_view indicated instead of string ?     
asked by 22.08.2018 / 20:22