home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_C / CL187A.ZIP / EXAMP201.CPP < prev    next >
C/C++ Source or Header  |  1994-03-15  |  601b  |  30 lines

  1. // Container Lite (CL v 1.87a)
  2. // (C) Copyright John Webster Small 1994
  3. // All rights reserved
  4. // examp201.cpp -- link with cl.obj
  5.  
  6. #include <stdlib.h> // rand(), srand()
  7. #include <time.h>   // time_t, time()
  8. #include "cl.h"
  9.  
  10. CL_WELL_ENDOWED(int)
  11.  
  12. #define intFile "ints.tmp"
  13.  
  14. main()
  15. {
  16.     time_t t;
  17.     srand((unsigned) time(&t));
  18.     CL<int> ci(CL_ANDS,15);
  19.     int i = 0;
  20.     while (ci.atInsNew(rand()%(ci.Nodes()+1),&i))
  21.         i++;
  22.     ci.save(intFile);
  23.     ci.allClr();
  24.     ci.load(intFile);
  25.     cout << "0-14 in random order: " << endl;
  26.     while (ci.atDelAsg(0,&i))
  27.         cout << i << endl;
  28.     return 0;
  29. }
  30.