Questions tagged as 'c++'

1
answer

Validate Data in c ++

I need to validate the numerical data entry in c ++, I am using: #include<iostream> #include<stdio.h> using namespace std; int main() { int dato; cout<<"Ingrese un valor para dato: "; while( ( cin>>dato )...
asked by 14.10.2017 / 13:53
1
answer

How can I declare a static memory c ++?

I have this code I would like to know what should change to use the (->) instead of using the (point) I think I have to add a new Lista<Punto> pLista; pLista.insetarFinal(Punto(8, 1)); pLista.insetarFinal(Punto(7, 2)); pLista.insetarF...
asked by 01.10.2017 / 10:06
2
answers

prime number with recursion

I do not know why this code explodes at runtime, any ideas? #include <iostream> using namespace std; bool esPrimo(int number, int cont = 1, int div = 0) { if (number % cont == 0) { div+=1; } else if (cont == nu...
asked by 09.09.2017 / 03:01
1
answer

I have an error "crosses initialization of 'player p3' when using the switch in C ++

#include<iostream> #include<string.h> using namespace std; class jugador{ char *nombre; float arg; char *equipo; int aux; public: jugador(char *, char *, float); ~jugador(); jugador(jugador...
asked by 21.09.2017 / 03:57
1
answer

Combine C ++ and Python

When creating graphical interfaces with C ++ I see a world, and I have been reading the possibility of combining two languages, one of them C ++. My question is, could you do all the essentials with c ++ but the graphical part with Python? That...
asked by 04.09.2017 / 04:28
2
answers

Detect, in the destructor, if we are a temporary instance

I'm trying to detect, in the destructor , if I'm in a temporary instance or not. The first thing I tried was to qualify the destroyers: ~S( ) & { ... } ~S( ) && { ... } With which I got a nice error message:    error:...
asked by 11.09.2017 / 07:56
1
answer

error: type / value mismatch at argument X in template parameter list

I try to create a backpack , a template class that acts as wrapper of another, and make calls to a callable provided in one of its arguments. I would like the callable to be both a class that supports operator( ) , and a normal f...
asked by 14.09.2017 / 14:12
2
answers

Problem filling vector

I made a method to fill a vector and another one to show it, when I execute the code it shows me the vector arriving only with values 0 This is the main int main(int argc, char** argv){ int opc, tam = 5; vector<int> vec(tam); llenarV...
asked by 16.06.2017 / 05:38
1
answer

I can not return the name

I am trying to get a method of a class to return a string that has been entered through the keyboard, showing it in a cout. However, I'm doing something wrong, because even though the program compiles I can not show the introduced string. Still...
asked by 14.06.2018 / 10:53
1
answer

Compiled error: 'was not declared in this scope'

When compiling this code, the compiler complains about the following error:    error : 'content' was not declared in this scope When it is apparently declared as an input parameter in the macro function. #include <iostream> #defi...
asked by 08.06.2017 / 07:15