Source of lnodedrv.cpp


  1: // Filename: LNODEDRV.CPP
  2: // Purpose:  Driver for a demonstration program to illustrate
  3: //           operations on a sequence of linked nodes.

  5: #include <iostream>
  6: using namespace std;

  8: #include "LNODEFUN.H"
  9: #include "PAUSE.H"


 12: int main()
 13: {
 14:     NodePointer head;
 15:     int menuChoice;

 17:     DescribeProgram();
 18:     Pause(0);

 20:     InitializeSequence(head);

 22:     do
 23:     {
 24:         DisplayMenu();
 25:         GetMenuChoice(menuChoice);
 26:         switch (menuChoice)
 27:         {
 28:             case  1: /* Quit */                               break;
 29:             case  2: InitializeSequence(head);                break;
 30:             case  3: PrintNodeValues(head);
 31:                      Pause(0);                                break;
 32:             case  4: BuildSequenceFixedSize(head);            break;
 33:             case  5: BuildSequenceAnySize(head);              break;
 34:             case  6: FindDataValues(head);                    break;
 35:             case  7: FindPositions(head);                     break;
 36:             case  8: InsertAfterNodeWithDataValue(head);      break;
 37:             case  9: InsertAfterNodeK(head);                  break;
 38:             case 10: InsertBeforeNodeWithDataValue(head);     break;
 39:             case 11: InsertBeforeNodeK(head);                 break;
 40:             case 12: DeleteNodeWithDataValue(head);           break;
 41:             case 13: DeleteNodeK(head);                       break;
 42:             case 14: ProcessAllNodes(head, Double);           break;
 43:             case 15: ProcessAllNodes(head, Square);           break;
 44:             case 16: ProcessAllNodes(head, ReverseAllDigits); break;
 45:         }

 47:     } while (menuChoice != 1);

 49:     return 0;
 50: }