Click here to Skip to main content
15,913,487 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: pointers to functions Pin
Richard MacCutchan16-Jul-22 1:09
mveRichard MacCutchan16-Jul-22 1:09 
General[edited]Re: pointers to functions Pin
Calin Negru16-Jul-22 1:45
Calin Negru16-Jul-22 1:45 
GeneralRe: [edited]Re: pointers to functions Pin
Mircea Neacsu16-Jul-22 4:26
Mircea Neacsu16-Jul-22 4:26 
GeneralRe: [edited]Re: pointers to functions Pin
Calin Negru16-Jul-22 4:40
Calin Negru16-Jul-22 4:40 
GeneralRe: [edited]Re: pointers to functions Pin
Richard MacCutchan16-Jul-22 4:56
mveRichard MacCutchan16-Jul-22 4:56 
GeneralRe: [edited]Re: pointers to functions Pin
Calin Negru16-Jul-22 5:50
Calin Negru16-Jul-22 5:50 
GeneralRe: [edited]Re: pointers to functions Pin
Richard MacCutchan16-Jul-22 6:01
mveRichard MacCutchan16-Jul-22 6:01 
GeneralRe: [edited]Re: pointers to functions Pin
Calin Negru16-Jul-22 6:57
Calin Negru16-Jul-22 6:57 
GeneralRe: [edited]Re: pointers to functions Pin
Richard MacCutchan16-Jul-22 20:58
mveRichard MacCutchan16-Jul-22 20:58 
AnswerRe: pointers to functions Pin
Greg Utas16-Jul-22 7:36
professionalGreg Utas16-Jul-22 7:36 
QuestionConvert decimal to binary in C Pin
sahil Ranka14-Jul-22 1:14
sahil Ranka14-Jul-22 1:14 
AnswerRe: Convert decimal to binary in C Pin
Mircea Neacsu14-Jul-22 1:25
Mircea Neacsu14-Jul-22 1:25 
AnswerRe: Convert decimal to binary in C Pin
Richard MacCutchan14-Jul-22 1:29
mveRichard MacCutchan14-Jul-22 1:29 
GeneralRe: Convert decimal to binary in C Pin
sahil Ranka14-Jul-22 2:42
sahil Ranka14-Jul-22 2:42 
AnswerRe: Convert decimal to binary in C Pin
CPallini14-Jul-22 2:36
mveCPallini14-Jul-22 2:36 
GeneralRe: Convert decimal to binary in C Pin
sahil Ranka14-Jul-22 2:42
sahil Ranka14-Jul-22 2:42 
GeneralRe: Convert decimal to binary in C Pin
CPallini14-Jul-22 3:14
mveCPallini14-Jul-22 3:14 
AnswerRe: Convert decimal to binary in C Pin
Richard MacCutchan14-Jul-22 21:15
mveRichard MacCutchan14-Jul-22 21:15 
QuestionPrey/predator c++ project Pin
sahil Ranka12-Jul-22 0:26
sahil Ranka12-Jul-22 0:26 
AnswerRe: Prey/predator c++ project Pin
Richard MacCutchan12-Jul-22 0:29
mveRichard MacCutchan12-Jul-22 0:29 
AnswerRe: Prey/predator c++ project Pin
Greg Utas12-Jul-22 1:20
professionalGreg Utas12-Jul-22 1:20 
If the size of the grid is static (m x n), you can just hard-code it:
C++
enum GridOccupant {EMPTY, PREY, PREDATOR};
GridOccupant Grid[m][n] = {EMPTY};
If the grid is dynamic, the question is whether you're allowed to use things from the Standard Template Library (STL), like std::vector[^], or whether you're supposed to allocate the memory yourself.

When the user specifies the location of Prey or Predator, you create one and add it to PreyAnimals or PredatorAnimals. Again, the question is whether you're allowed to use the STL. Each Animal (the base class for Prey and Predator, if this helps your design) keeps track of its location in the Grid to make it easy to find.

You might discover that you don't need Grid at all, only its dimensions (m x n).
Robust Services Core | Software Techniques for Lemmings | Articles
The fox knows many things, but the hedgehog knows one big thing.

QuestionHow to share a pointer between an EXE and a DLL Pin
Mircea Neacsu11-Jul-22 13:50
Mircea Neacsu11-Jul-22 13:50 
QuestionRe: How to share a pointer between an EXE and a DLL Pin
CPallini11-Jul-22 20:12
mveCPallini11-Jul-22 20:12 
AnswerRe: How to share a pointer between an EXE and a DLL Pin
Mircea Neacsu12-Jul-22 4:01
Mircea Neacsu12-Jul-22 4:01 
GeneralRe: How to share a pointer between an EXE and a DLL Pin
Victor Nijegorodov12-Jul-22 6:22
Victor Nijegorodov12-Jul-22 6:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.