Hi, so I have class Dinosaur, I have fields for the dino, I have class Cage, I have fields for the cage and I have Dinosaur*fDinos in class Cage. One of the Cage class fields is char* fSize. If the size is small I can add one Dino, if the size is medium - 3 dinos and large - 10 dinos. I have class Jurassic where I have Cage*fCages.
I have these methods:
So the question is: how to add a dino to the cage if there is space in the cage /for example if it is empty and it is larg I can add 10 dinos, if it is medium and a ihave 1 dino already in there how to add 2 more and so on/? And if I don't have space for the dino I have to add a new cage to Jurassic park. Please help, do I have to create a new method, what parameters should I have, this is for OOP project c++, can't use strings or vectors.
Hint: You can edit your post, highlight your code and press the <> formatting button. This will not automatically indent your code. That part is up to you.
You can use the preview button at the bottom to see how it looks.
I found the second link to be the most help.
The functions are nice, but without the class definition I have no idea if what you are doing is correct because I have no idea what you are working with.
Also without enough of "main" to set up and use these functions I have no idea what should be there.
That is just me. I am more a hands on see how it works type person.
we have:
cage[particular cage].dino[i]
or example: cage[4].dino[5] the sixth dino in the fifth dino
so I gotta have a getter in the dino class that will always return 1 cause every dino on their own is just one dino
the in a for cycle
for(int i=0; i<MAX_SIZE_OF_THE_CAGE;i++)
{counter+=cage[particular cgae].dino[i].getnumber();}
and if the counter is less than the max size of the cage I just add a new Dino.
Is that a good idea and how I can improve it?