Questions tagged as 'c++'

1
answer

What is the difference between pointer to vector and pointer to variable?

int A; int* pA = 1; int Vect[2] = {1,2}; int* pVect; pA = &A; *pA = 2; pVect = Vect; pVect[0] = 10; In the case I have a pointer to a variable and then to a vector, and I want to change its values by the pointer. Why is there such a dive...
asked by 29.03.2017 / 06:31
1
answer

Problem with vector return in c ++

I'm trying to do a program to sort vector and I'm using an auxiliary function to do this, but I'm getting this error message. /media/isaque/dados/exercicios/c/scripts/estrutura de dados com c++/busca_binaria.cpp: In function ‘void ordenar_veto...
asked by 27.03.2018 / 19:28
2
answers

Problems with extensive algorithm [closed]

I do not know what to do, I think I've made some mistake that I do not know. In my program the user must think of a number, and the computer should try to guess what number the user thought. The computer may ask the user for a few times wheth...
asked by 14.01.2017 / 22:11
1
answer

I'm having a problem with Dev C ++ in displaying members of a class

To be more exact, when I press "." after some object, type I declare a vector: vector<int>Random; So far so good, so when I start typing: Random.push_back(); Dev c ++ does not help me complete, I know it sounds paranoid, but is i...
asked by 18.01.2017 / 17:48
1
answer

Split numbers of an int. C ++

Hello! I'm reading and studying C ++ in the book "C ++ How to Program 5th Edition". There is a question on pg 97. Question 2.28 which I can not perform, it being: Write a program that inserts a five-digit integer, separates the integer into it...
asked by 22.01.2017 / 19:05
2
answers

How to calculate the Xmin, Xmax, Ymin, Ymax of an object?

I'm doing a simple " space invaders" game in OpenGl and in the part of the collisions I need to calculate the minimum and maximum X and Y values, but I still can not figure out how to do this. This is the code I use to create an enemy ship:...
asked by 17.01.2017 / 16:07
2
answers

C ++: header file not recognizing class

I'm working with several classes, and to organize myself better, I put each class in a different file. actor.h #ifndef ACTOR_H #define ACTOR_H #include "SDL.h" #include <string> #include "collision.h" #include "world.h" class Actor...
asked by 04.06.2017 / 01:32
2
answers

How to omit char array size in function?

I came up with a question now, I have a function implemented this way: mostrarMensagem(char msg[10]) { //aqui faço algo com a variável "msg". } But I do not know the size that I will receive as the actual parameter, if it is greater than 10...
asked by 29.06.2017 / 06:17
2
answers

playsound function

I am aa program a game for school work in C ++, and I have a game that during its execution starts a song, then when I click on the space key to fire the music stops and you only hear the gun shot. / p> I wanted to be able to play both the bac...
asked by 29.10.2016 / 16:51
2
answers

Declare local classes as public

Hello, I have a problem that explodes my head : I'm doing a script in C ++ with the purpose of making a game. All was well when I ended up in a case that, from what I researched, I found no solution in ST. 1st the script, then the problem its...
asked by 14.11.2016 / 01:55