Questions tagged as 'c++'

1
answer

error: field has incomplete type

I get this error    error: field has incomplete type when doing something like: class MinhaClasse { MinhaClasse teste; // Erro aqui }; I already tried to add this line at the beginning of the code class MinhaClasse; , but it...
asked by 01.02.2018 / 15:39
2
answers

Problem on discrete mathematics - C ++

I have this problem to solve, about Pigeon House Principle. However, it has 25% error and only has an input sample.    For some unknown reason, Rangel only has one pair of socks of each color.       Today he is late to go to college and sti...
asked by 05.11.2018 / 00:19
2
answers

What is wrong with the logic of this code that adds numbers tracks?

My algorithm needs to sum all values between a and b , for example if I type a=3 e b=6 the program needs to speak 3 7 12 18 (3+4= 7/ 7+5=12 / 12+6=18) only it only makes the first two then it starts to err. #include &...
asked by 13.05.2018 / 03:47
1
answer

How to Capture Command Line Information

How can I do that, when typing a character, I can read the next one without the loop continuing until the iteration count is finished? Follow the code below. #include <iostream> using namespace std; int main(){ int aluno; float...
asked by 21.09.2017 / 21:06
4
answers

What's wrong with my class's function to decrease the value?

I'm developing a class so I can better manage my items in a more organized way. When the value of the variable is less than the minimum value was to go to the maximum value, however, in practice this is not happening, it will stop some strange v...
asked by 10.10.2017 / 00:49
1
answer

How to reference instance variable with the same name as a local variable in C ++?

In C ++, how can I reference an instance variable that has the same name as a global variable? For example, in a set method of the following class: class Person { private: string name; public: void setName(string name) {...
asked by 23.10.2017 / 00:09
2
answers

Call cd command in c ++ using system ()

I'm trying to "program a shell" inside C ++ but I'm not able to use the cd (path) command it just will not, I searched and saw that when I use system() a new shell is created outside the directory we are in so I can not use it, what would...
asked by 21.06.2017 / 21:27
2
answers

Error translating structure code from C ++ to C #

I'm trying to read a string from a process, I found this structure on the internet: struct name { wchar_t nome[32]; }; I did it this way: struct name { public char[] nome = new char[32]; } And I'm returning the following erro...
asked by 27.11.2017 / 22:13
1
answer

Why use a pointer in this algorithm?

When I retreat the code does not work. Why? And why is the insert emulation algorithm algorithm only suitable for list of small entries, type array and list / p> void insert_sort(int *vetor, int TAM){ int i, j, aux; for(i = 1...
asked by 15.11.2017 / 18:49
1
answer

How to create multiple .txt files?

How do I create multiple .txt files in c / c ++? I have this function: tocopy(){ FILE *file = fopen("Teste.txt", "w"); fclose(file); } But it only creates a test.txt file     
asked by 30.09.2016 / 06:05