Questions tagged as 'c++'

1
answer

Knapsack with GA

Good morning, I am working on this quite simple algorithm that tries to solve the problem of knapsack with a genetic algorithm. I have based on what I have learned from the internet and the algorithm compiles and works, but it always gives me 0...
asked by 01.03.2016 / 20:36
1
answer

Failures using 'std :: initializer_list' with 'const char *', 'const char * &' and 'std :: string'

I have a simple program that uses a variable template of type std::initializer_list that stores pairs that contain a type and a text: using name_t = const char *; template <typename key_t> using key_name_t = std::pair<key_t, n...
asked by 17.04.2018 / 11:29
1
answer

Is there an equivalent to cin.clear () and cin.ignore () in Java?

I have a method that helps me to validate variables int , but when I pass them from C ++ to Java the ignore and clear methods do not work for me. Is there any equivalent to those functions in Java ? int ValidaInt(){...
asked by 14.05.2017 / 02:23
1
answer

How to solve the error undefined reference to '__imp_WSAStartup'

I thought how can I access web pages through a program in c ++? one thing led to the other and I found myself reading about Sockets on the microsoft page Creating a basic Winsock application and initializing Winsock . Well, put all the code...
asked by 19.03.2017 / 05:08
0
answers

pass an array of c # to c ++

I am using native code in c #. I'm trying to pass an array of c # to c ++ using Pinvoke. Once in c ++, I want to fill that array that I passed as a parameter with the values of a cv :: Mat. The problem is that I'm using the copy function and I d...
asked by 29.08.2017 / 10:50
1
answer

I can not record .txt files with QFileDialog C ++ QT

This is my code: void MainWindow::save(){ QString fileName = QFileDialog::getSaveFileName(this, tr("Save Text File"), path, tr("Text Files (*.txt)")); if (fileName != "") { QFileInfo info(fileName); path = info.absolu...
asked by 25.02.2016 / 15:58
0
answers

Help linked list overwrites string [closed]

The problem arises when I upload the data from a binary file to memory. I do not understand why the values of the string (Desc.) Of each product are overwritten (copying the description of the last product to all the previous ones) but the numer...
asked by 23.04.2017 / 00:43
1
answer

Garbage in vector

I am trying to read a file byte by byte and load each byte as an element of the vector, but for some strange reason the first two elements of the vector appear as strange characters (garbage). #include <iostream> #include <fstream>...
asked by 27.06.2016 / 23:03
3
answers

Logical conditions in C ++

I have a question about the logic in the C ++ conditions. I have the following code: if (distanciaCM<=50 && digitalRead(bombaPIN) == HIGH || f=="off"){ //mi código si se cumple la condición } Now, am I correct if I say that the c...
asked by 22.01.2018 / 18:52
2
answers

Value placement NOT constant in fixes

Good evening, I try to create a C ++ program that combines arrays in for and switch; however, I mark error in the declaration of the variable numbers [p], I know that it is because the number between the brackets must be a constant. My question...
asked by 14.11.2017 / 04:15