Question: C++ Program: Write a program that calls a function (named counting ) five times. The function uses a local static integer variable to keep track

C++ Program:

Write a program that calls a function (named counting) five times. The function uses a local static integer variable to keep track of how many times it gets called. Note: a local variable is one that is declared inside the function or a block within a function; it is visible or can be referenced only within the function or the block of code delimited by a pair of curly brackets or braces (see the next program P1.4)

This is what I have so far:

#include "stdafx.h"

#include

using namespace std;

int counting();

int main()

{

counting();

system("pause");

return 0;

}

int counting(int num)

{

for (int i = 0; i < 5; i++)

return i;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!