home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c017 / 34.ddi / CSTRM.ZIP / BDRDEM2.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-23  |  1.0 KB  |  57 lines

  1.     // bdrdem2.cpp
  2.     // Demo some stack, queue, list, array, and sort
  3.     // member functions.
  4.  
  5.     #include <string.h>    
  6.     #include <iomanip.h>
  7.     #include <binder.hpp>
  8.  
  9.  
  10.     main()
  11.     {
  12.         Binder B;
  13.         
  14.         B.push("Now is the time");
  15.         B.atIns(B.Nodes(),"for all programmers");
  16.         B.insQ("to stop reinventing");
  17.         B.setCurNode(B.Nodes()-1);
  18.         B.ins("the linked list!");
  19.         
  20.         cout << "\n\nBinder contains the following "
  21.             << "nodes:  \n\n";
  22.     
  23.         for (B.setCurNode(); B++;
  24.             cout << (char *)(voiD) B << endl);
  25.             
  26.         cout << "\n\nPress enter to continue ... ";
  27.         cin.get();
  28.         
  29.  
  30.         
  31.         
  32.         Binder B2;
  33.         
  34.         B2.setComparE((BDRcomparE)strcmp);
  35.         
  36.         while (B2.insSort(B++));
  37.             
  38.         B.sort((BDRcomparE)strcmp);
  39.         
  40.         cout << "\n\nAnd the Binder sorted:\n\n";        
  41.  
  42.         while (B.setCurNode(0))
  43.             cout << (char *) B.del() << endl;
  44.             
  45.         cout << "\n\nAnd an alternate Binder "
  46.             "insertion sorted:\n\n";
  47.             
  48.         while (B2.Nodes())
  49.             cout << (char *) B2.pop() << endl;
  50.             
  51.  
  52.         cout << "\n\nPress enter to quit ... ";
  53.         cin.get();
  54.  
  55.         return 0;
  56.     }
  57.