This is a stupid question, but honestly I can't get it to work in my program. I just started C++ and I keep doing it wrong. I have the user enter in the value of 'pile' and then i want to go over to my second function and divide pile by two. My professor says I'm not allowed to use global variables. Here's my code:
int playerTurn();
int main() //first function
{
int pile = 0;
while ( pile < 10 || pile > 100 ) {
cout << "How many marbles would you like there to be?" << endl;
cout << "Please choose between 10 and 100: ";
cin >> pile;
}
return pile; //the variable I'm trying to return is pile
playerTurn();
}
int playerTurn(pile) //second function
{
int limit = pile / 2; //says pile is an undeclared identifier
}
I can't seem to get the 'pile' over to my other function, playerTurn