Questions tagged as 'c++'

1
answer

Differences between execv () and system () function in C

I'm doing a command interpreter in C and I have a problem with the execv function. I use a method called readCommand to read a text string and divide it into an array with the command and parameters. Then I pass to the functio...
asked by 16.12.2016 / 23:52
1
answer

No matching constructor for initialization, c ++ Error

I have a Matrix class that has a copy constructor and an add method that adds the matrix to another and returns a new matrix, but I can not use the copy constructor with this method. #include <iostream> #include "matrix.h" #include "meth...
asked by 30.09.2018 / 19:49
1
answer

Repeated results in C ++

I have created a code in which I register a certain number of soccer players and at the end they print their data, but these are repeated according to the last registered player. This is my code: #include <iostream> #include <cstdlib&...
asked by 26.11.2018 / 03:26
1
answer

Problems iterating over a list within a class

Let's consider the following code. It has a class that contains a data and a list of elements of the other class, which houses its own data and a pointer of the first type to relate. It would be schematically like this: struct nodo { dato...
asked by 14.05.2018 / 23:38
1
answer

List folders and files in Qt Creator

I want to make a program that tells me what folders and files I have within a given route. The code that I used is the following: #include <QDir> #include <QDebug> int main(){ QStringList lista = QDir("C:/Imagenes").entryList...
asked by 03.10.2017 / 16:25
2
answers

How to paint the background of a text in the console

#include <iostream> #include <windows.h> #include <conio.h> #define ARRIBA 72 #define IZQUIERDA 75 #define DERECHA 77 #define ABAJO 80 using namespace std; int i=4; void SetColor(int ForgC) { WORD wColor;...
asked by 11.06.2016 / 03:29
2
answers

Delete items from a list represented in a QTabWidget

I have a class MainWindow derived from QMainWindow class MainWindow : public QMainWindow { Q_OBJECT private: struct MetaObra { InterfazObra* miobra; QString nombrefichero; MetaObra():miobra(n...
asked by 21.04.2017 / 02:19
1
answer

How to get the names of the files in a directory? C ++

I have a media / map directory, in that folder there are many files, example ".mesh.xml", ".mesh", etc. I need to create a function that stores the names of the ".mesh" files in a string array and ignores the others including ".mesh.xml". C...
asked by 30.05.2017 / 00:10
1
answer

Error: Expression must have a constant value

   Expression must have a constant value I get this error on line int mas[n] . Why does the error occur? int main() { int n; cout << "Enter the number of elements: "; cin >> n; int mas[n]; srand(time(NULL)...
asked by 28.11.2016 / 10:52
2
answers

My crash program when entering any number after 10

To see the error, when you ask for the number, write 10 or greater. #include <iostream> #include <stdlib.h> using namespace std; int sumalol; int z=0; int x; int promedio(int digitos[]) { int suma; for (int i = 0; i < z;i++...
asked by 07.10.2016 / 19:09