first off i apologize for my ignorance but i cant seem to find a clear answer to this question, if i have a function with variables in it, do those variables reset every time i call the function for example if i write code to build a game and then have a function such as this to count score:
void scorecounter(bool playgame, bool playagain){
int win;
int loss;
if (playgame==false){loss++;}
else if(playgame==true){win++;}
if(playagain==false){cout<<"Wins: "<<win<<" Losses: "<<loss;}
}
note that playGame and playagain work in seperatly declared functions.
the thing is i have to call this function after every time the user plays a game and then use this to record if they have won or lost, the thing is does win and loss reset after evertime i call this function therefore making it useless? do i need global varaiables? thanks!