I looked up some stuff before writing this, about how you can't use a nested function in a function, and that you would need to have a nested struct/class. That isn't what I seem to be doing, and what I am doing compiles just fine.
But what I am wondering is: If it's bad practice to call (I hope that's the right terminology) another function from within a function that isn't your main function.
Something like what is seen in my code:
using namespace std;
cout << "Initial message!\n";
cout << "It is now Player 1's turn.\n";
cout << "Player 1 obtained some apples!\n";
It is now Player 1's turn.
Player 1 obtained some apples!
What I'm talking about is how I first have the program call Player1Turn()
in my main function, but then Player1Turn()
then calls GetApples()
Is this okay to do, or is it bad practice and should I try a different way of doing things?
(This is only an example code, the actually command console game I'm making is more complicated, so I wanted to keep my post short and to the point.)
P.S. Does anyone know how long it takes for a topic to be archived? I can't find anything that says it. A week? 30 days? 60 days?