Questions tagged as 'c++'

2
answers

Matrix as an attribute?

I am trying to create a board, with different dimensions, that is, 3 x 3, 4 x 4 and 5 x 5 The problem is that I do not know if the part of the attributes of my board class is well declared. Can you tell me if it's okay? On the other hand, I w...
asked by 15.10.2018 / 02:24
2
answers

Convert from Hex String to Unsigned Char Array in C ++

I need to convert a string of string characters to an unsigned char array in this way: string hex_str_texto = "0A4F1B3D5EEF354A"; unsigned char uchar_texto[80]; Exit: uchar_texto[0] = 0x0A //Primeros dos elementos del string uchar_texto[...
asked by 12.09.2018 / 19:32
3
answers

Restrictions of the ternary operator ?:

I have this piece of code: (comprar >= 1 && comprar <= 40) ? ActualizarAsientos(Asientos, comprar) : cout << "Asiento fuera de rango"; Where the first condition is a void and the second one a text output, however...
asked by 15.04.2018 / 02:16
2
answers

C ++ error no matching function for call to 'Node :: Node (point &, float &, Node &)'

I have an error in the code, precisely in the constructor, the compiler says that I am not passing the appropriate parameters, to put in context, this is the class that the constructor has, I only put the relevant functions to understand the dou...
asked by 20.11.2018 / 00:56
2
answers

Change a variable within a function each time you call it

This program must cause two bots to attack each other, first one then the other, and I made an attack function but I do not know how to make it general for when I call it the first time the variables that are inside the function correspond to th...
asked by 07.10.2018 / 17:53
2
answers

Validate an object within set, list, map

class Coordenada(){ int fila; int columna; //los getter and setter } int main(){ std::set<Coordena> coordenadaSet(Coordenada(4,6)); Coordenada coordenada(5,6); if(coordendaSet.find(coordenada) != coordenadaSet.end()){...
asked by 08.10.2018 / 11:10
2
answers

Doubt about constexpr

Why not always use the reserved word constexpr when defining methods or functions? If he calculates everything he can in compilation and what does not, he finds it running, without causing error.     
asked by 09.10.2018 / 22:25
2
answers

Is it advisable to declare and initialize a variable within a loop?

good. after solving this I exercise with this Answer I skip the doubt if it is a good idea to declare and initialize a variable within a loop. this is done in order to avoid writing i = 0 and of = "email_.txt" in the code....
asked by 01.10.2016 / 02:02
3
answers

Get system date

I am doing a program in #C for the university and I need to get the current system date to know when the person has registered. So far to catch the date I have this: time_t tiempo = time(NULL);//variables donde guardo el valor de la funcion...
asked by 11.04.2017 / 12:49
2
answers

Doubt about matrix travel

I have a question about how to go through the even rows of a matrix, I put it this way: for(int i=2;i<=get_m();i+2) My question is: In the increment part of the row can i+2 be made to go through only the even rows?     
asked by 13.08.2017 / 14:28