home *** CD-ROM | disk | FTP | other *** search
/ The Devil's Doorknob BBS Capture (1996-2003) / devilsdoorknobbbscapture1996-2003.iso / Dloads / OTHERUTI / TCPP30-3.ZIP / EXAMPLES.ZIP / INTRO27.CPP < prev    next >
C/C++ Source or Header  |  1992-02-18  |  326b  |  22 lines

  1. // INTRO27.CPP--Example from Chapter 3, "An Introduction to C++"
  2.  
  3. #include <iostream.h>
  4. #include <conio.h>
  5.  
  6. void tally(void);
  7.  
  8. int main()
  9. {
  10.     while ( getch() != 'q')
  11.         tally();
  12.  
  13.     return 0;
  14. }
  15.  
  16. void tally(void)
  17. {
  18.     static int called = 0;
  19.     called++;
  20.     cout << "Function tally called " << called <<" times\n";
  21. }
  22.