Questions tagged as 'c++'

2
answers

Difference between the constructors of C ++?

Hi, I just saw a video about c ++ but it's in English, there was a part where I started explaining about POO, and he talked about the builders, I understand what it is, but he did two of which I do not know his differences. This is the first...
asked by 14.01.2018 / 06:06
2
answers

Declare arrangement of 0 = N = 2000000

The program crashed I need to declare an array of 2000000 elements, how do you declare it? Problem Write a program that given the list of N numbers determine in what position the element a0 (the first one on the list) remains after it...
asked by 23.05.2017 / 02:47
2
answers

Is it possible to initialize an array of x length assigning values in C ++?

I would like to know if it is possible to initialize an array by assigning values. Is the only way iterating with a for ? Something that is very easy in Javascript is to declare a variable assigning values, and also has the advantage...
asked by 28.05.2017 / 23:21
1
answer

Doubt about parameters && in functions

Could someone explain to me what it means, a parameter defined with & & amp; Example: strc::strc(strc && o) { data = std::move(o.data); o.data = nullptr; msg("move ctor"); } Thanks. JC     
asked by 11.05.2018 / 22:19
2
answers

Pass a std :: vector by reference (Avoid Copy)

I am developing a mini-game. The classes involved in this question are: PlayState IA Terrorist. PlayState gives a Terrorist Vector to IA . Intelligence = new IA(terrorists, p->getRigidBody(), _world); The definiti...
asked by 04.07.2017 / 10:52
2
answers

Concatenate a string with a C ++ float

I have a problem when concatenating a string type variable with a float, I have the following: float c1 = 0, c2 = 0, c3 = 0; std::string best = ""; Then I use it in the following way: best = "Imagen 1: " + c1; best = "Imagen 2: " + c2; be...
asked by 01.11.2016 / 21:40
2
answers

Doubt with cstring and string

I am not clear about the difference between the cstring library and the string library. As I understand it, the string header is, as the name implies, for string types, while cstring is for using its functions with char type.     
asked by 29.11.2016 / 03:24
2
answers

Correct way to display array

Which way is the most recommended to show an array in a function? typedef int TVector[10]; with const : void MostrarArray(const TVector &v){} ^^^^^^^^^^^^^^^^ directly: void MostrarArray(TVector v){}...
asked by 16.08.2016 / 02:01
1
answer

Poor handling of events [SFML]

Nesesito know why my program exploits for no reason, and how could I solve it, I'm moving in the architecture of a game, very simple, for now I only have the class Stage that serves as the main event which drew in the window everything th...
asked by 05.11.2017 / 17:58
2
answers

Replace a character of a string and show the final string with spaces included

Basically my code is ready, the only problem is that when I show the modified end string, it only shows me the first word (When it finds a space it ignores the rest) I know that my program stops counting when it meets "\ 0" and I also know that...
asked by 24.03.2017 / 17:07