Write a program that checks how many times a function was called from the main program. We will use a local static
variable inside a function, and we will increment this variable each time the function is called in main():
void myfunction()
{
static int counter = 0;
counter++;
std::cout << "The function is called " << counter << " time(s)." << '\n';
}
int main()
{
myfunction();
myfunction();
for (int i = 0; i < 5; i++)
{
myfunction();
}
}