Actual question. It keeps telling me I need to use numcall??
Write the definition of a function named alternator that receives no parameters and returns true the first time it is invoked, returns false the next time it is invoked, then true , false and so on, alternating between true /false on successive invocations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
staticbool alternator()
{
int alternator;
if (alternator % 2 == 0)
{
bool status = false;
returnfalse;
}
else
{
bool status = true;
returntrue;
}
alternator++;
}