Alright so I can get this working fine if i take out the code from SetNumberOfEnemies() and put it inside StartUp(). But now that it's in its own function it'll compile but it wont tell me how many enemies I've created etc.
In the if statement that line of code will never run. After the user inputs how many enemies he wants the game just finishes and doesn't display the output.
void StartUp()
{
bool isGameAlive = true;
int *numberOfEnemies = newint;
SetNumberOfEnemies(numberOfEnemies);
do
{
}while(isGameAlive == true);
}
void SetNumberOfEnemies(int *enemies)
{
while(*enemies < 1 || *enemies > 20)
{
printf("Enter the amount of enemies you would like to fight between 1 and 20:\n\n >> ");
scanf_s("%d", *enemies);
if((*enemies > 0 || *enemies < 21))
{
printf("\nThe Number of Enemies You Will Fight Is : %d\n", *enemies);
}
}
}
Ah well - basically as you know when its for study it does have requirements. I've only wrote this bit of code quick in my actual bigger version I have de-allocated it. I did have the int set to a a value but that wasn't working before. I'll try it again now though
Thanks Zaita
EDIT:
Changed the specifications to how you said. Still isn't working. Preferably wouldn't do it like this but yeah. Damn requirements but at the same time I'm learning more.