Create a function called Count() that keeps track of how many times it has been called. Each time it is called, it should display a line similar to:
This is call Number 5
Demonstrate that it works by setting up a loop in main() that will call it five times. Do not use reference variables. Do not keep track in main(). Count() must keep track. Hint: this is a *really* easy problem.
1
Expert's answer
2011-10-28T09:11:50-0400
#include <iostream.h> #include <conio.h> int i,c=0; int count(){ & c++; & cout<<"This is call Number "<<c<<"\r\n"; & } main(){ for (i=1;i<=5;i++) count(); getch(); }
Comments
Leave a comment