Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(i) In any programming language except Fortran, C, Java, or Lisp,write a program

ID: 3616690 • Letter: #

Question

(i) In any programming language except Fortran, C, Java, or Lisp,write a program like this, in which a function keeps track of thenumber of times it is called and prints that count each time it iscalled.

 Program Count

C Demonstration of static variables in Fortran.

print *, 'Starting Test Program'
Call CountingRoutine()
Call CountingRoutine()
Call CountingRoutine()
Call CountingRoutine()
Call CountingRoutine()
End

Subroutine CountingRoutine ()
C Keeps track of the number of times it has been called
C and prints that count each time.
Integer count
Data count/0/
count = count + 1
Print *, 'count = ', count
Return
End


(ii)What programming language did you use?

(iii)Was the variable that kept track of the count a staticvariable, a stack-dynamic variable, or a heapdynamic variable? Ifnone of these, where was the memory for your variable allocated,and what was the lifetime of your variable?

Explanation / Answer

please rate - thanks #include using namespace std; void CountingRoutine(); int main() {CountingRoutine(); CountingRoutine(); CountingRoutine(); CountingRoutine(); CountingRoutine(); system("pause"); return 0; } void CountingRoutine() {static int count=0; count++; cout