home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c063 / 3.ddi / CLASSEXM.ZIP / QUEUETST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-18  |  929 b   |  56 lines

  1. #ifndef __LTIME_H
  2. #include <LTime.h>
  3. #endif    // __LTIME_H
  4.  
  5. #ifndef __QUEUE_H
  6. #include <Queue.h>
  7. #endif    // __QUEUE_H
  8.  
  9. #ifndef __IOSTREAM_H
  10. #include <iostream.h>
  11. #endif
  12.  
  13. #ifndef __DOS_H
  14. #include <dos.h>
  15. #endif
  16.  
  17. #ifndef __STDLIB_H
  18. #include <stdlib.h>
  19. #endif
  20.  
  21.  
  22. int main()
  23.  
  24. {
  25.  
  26.  
  27.     int k;
  28.     Queue timeLine;
  29.     cout << "\nSampling";
  30.     for( int i = 0; i < 7; i++ )
  31.     {
  32.     struct time snapShot;
  33.     gettime( &snapShot );
  34.     Time sample( snapShot.ti_hour,
  35.              snapShot.ti_min,
  36.              snapShot.ti_sec,
  37.              snapShot.ti_hund );
  38.     timeLine.put ( *(new Time( sample )) );
  39.     cout << ".";
  40.     randomize();
  41.     k = rand();
  42.     for(int j = 0; j < k; ++j )  // Delay loop
  43.          {
  44.          cout << "";
  45.          }
  46.     }
  47.     cout << "\nThe timing samples are:\n\n";
  48.     while( !timeLine.isEmpty() )
  49.     {
  50.     Time& sampleTime = (Time&)timeLine.get();
  51.     cout << sampleTime << "\n";
  52.     delete &sampleTime;
  53.     }
  54.     return 0;
  55. }
  56.