home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 May / Pcwk0597.iso / borland / cb / setup / cbuilder / data.z / MINICOMP.CPP < prev    next >
C/C++ Source or Header  |  1997-02-28  |  1KB  |  35 lines

  1. //----------------------------------------------------------------------------
  2. //Borland C++Builder
  3. //Copyright (c) 1987, 1997 Borland International Inc. All Rights Reserved.
  4. //----------------------------------------------------------------------------
  5. //-------------------------------------------------------------------------
  6. //    minicomp.cpp - uses the TCounter example component
  7. //-------------------------------------------------------------------------
  8. #include "minicomp.h"
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. //-------------------------------------------------------------------------
  12. main()
  13. {
  14.   TExample example;
  15.  
  16.   return 0;
  17. }
  18. //-------------------------------------------------------------------------
  19. TExample::TExample()
  20. {
  21.   TCounter Counter(7);
  22.   int i;
  23.  
  24.   Counter.OnMultiple = MultipleReached;
  25.  
  26.   for (i=0; i < 100; i++)
  27.     Counter.Increment();
  28. }
  29. //-------------------------------------------------------------------------
  30. void TExample::MultipleReached(TCounter *Sender)
  31. {
  32.   printf("Multiple=%d reached with val=%d\n", Sender->Multiple, Sender->Val);
  33. }
  34. //-------------------------------------------------------------------------
  35.