Answer:
The solution code is written in C++
Explanation:
We need a global variable to track the status of true or false (Line 1).
Next, create the function alternator (Line 2) and then check if current status is true, set the status to false but return the previous status boolean value (Line 5-6). At the first time of function invocation, it will return true.
The else block will set the STATUS to true and return the false (Line 7-9).