Questions tagged as 'c++'

1
answer

How to concatenate values of different types in a string?

How do I concatenate all this string within a variable? Is there a more elegant way to solve my problem? int num1 = 1; int num2 = 2; int num3 = 3; char simbol1 = '+'; char simbol2 = '-'; string equation = num1 + " " + simbol1 + " ( "...
asked by 26.09.2018 / 21:05
1
answer

Why normal functions can not have "auto" arguments if lambda expressions can in C ++?

Today, I noticed that lambda expressions accept arguments of type auto for example: auto add = [](const auto& x, const auto& y) { return x + y; } So I tried with normal functions and it did not work: auto add(const a...
asked by 29.08.2018 / 03:57
1
answer

vector within vector generates duplicity of values in the second dimension

In the example below (which can also be seen in the Ideone ), I have vector of a class and within class I I have an element also vector . The point is that when doing push_back of the class, the internal vector vetint...
asked by 29.05.2018 / 04:10
2
answers

How to find out the data type of a binary file

One problem I often face is figuring out what kind of data to use to store the contents of a binary file. For example, when I start a simpler emulator project like CHIP8 or Gameboy, I usually use a 8-bit value data type as unsigned char o...
asked by 29.05.2018 / 13:50
2
answers

Create directories in c ++ with Linux

I want to create a directory in the home folder with c ++, but there is no way to do this in a cross-platform way. I have found that in the "sys / stat.h" library has the mkdir function that creates directories, but in addition to the directory...
asked by 22.05.2018 / 19:26
1
answer

Error converting 'int' to 'int *'

I wanted to know why you are causing the error:    Error converting 'int' to 'int *' This program is only for training the use of pointers in parameters. void teste(int *t){ *t = 50; } int main(){ int x = 10; cout << "Sem u...
asked by 30.04.2018 / 02:24
2
answers

Specific libraries and C compiler defaults in Windows and Linux

I'd like to know why conio.h and strrev() of library string.h , there is no Linux. Is there anything else that can only be done in Windows? And why this happens? Is there anything that can only be done on Linux? I did some...
asked by 04.06.2018 / 15:57
1
answer

"No match for operator" error in C ++

I made this code but I have not the slightest idea why it is giving this error: "No match for 'operator < In the part where I display the user's response ... (Remember that PersonName is a class and Date is also ...) class Filme { privat...
asked by 17.03.2018 / 02:15
1
answer

Create / manipulate file within a directory other than main.cpp

This works, creates a file and places what I want inside it: #include <fstream> #include <vector> using namespace std; int main() { ofstream arquivo; arquivo.open("arquivo.txt"); vector<string> v; v.push_back...
asked by 20.05.2018 / 17:33
2
answers

How to print UTF-8 characters in c ++ console?

The console incorrectly displays accented characters. How to print them correctly (UTF-8)?     
asked by 20.05.2018 / 02:16