Ask Question
2 April, 08:00

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.

+3
Answers (1)
  1. 2 April, 08:43
    0
    Visual C + + Programming is the software where the function defined in the question can be used. The return type of the Boolean method is applied. This is the code for the function.

    bool newbie ()

    {

    static bool x = true;

    if (x) {

    return true;

    } else {

    return false;

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write the definition of a function named alternator that receives no parameters and returns true the first time it is invoked, returns ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers