The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 313 Weeks Ago, 3 Days Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
You helped me once before and you were really awesome and I was wondering if I could get your help again. It doesn't seem that complicated and the code is all there, but I'm having some trouble figuring it out. Attached are the files and at the top of both .c files are the instructions. Also the way to test the program is through the command line. Thanks in /**
Lab Problem #2 Objective:
1. Given that pHead is a global variable declared in
  DoubleLinkedList.c - rewrite all the functions that
  use pHead to accept a passed parameter that points
  to the head of the doubly-linked list used in the
  code examples in the following modules:
   a. DoubleLinkedList.c
   b. DoubleLinkedList.h
   c. doubleMain.c (if necessary)
   d. doubleMain.h (if necessary)
Lab Problem #2 Suggestions:
1. Make sure the four modules listed in items 1a thru 1d
  above are in the SAME directory.
2. Compile with the command:
  gcc DoubleLinkedList.c doubleMain.c -o doubleListX
3. Test with a few simple steps.
4. Start working on the objective 1 above by editing the
  appropriate modules.
**/
#include <stdio.h>
#include <stdlib.h>
#include "DM.h"
int main(void)
{
   int choice =0;
   int InputNumber=0;
   printf("\nThis program creates a double linked list");
   printf("\nYou can add nodes in forward and reverse directions");
   do
   {
       printf("\n1.Create Node Forward");
       printf("\n2.Create Node Reverse");
       printf("\n3.Delete Node");
       printf("\n4.Display Nodes in forward direction");
       printf("\n5.Display Nodes in reverse direction");
       printf("\n6.Reverse nodes");
       printf("\n7.Exit\n");
       printf("\nEnter your choice: ");
       scanf("%d",&choice);
       switch(choice)
       {
             case 1:
             AddNodeForward();
             break;
             case 2:
             AddNodeReverse();
             break;
             case 3:
             printf("\nEnter the node you want to delete: ");
             scanf("%d",&InputNumber);
             DeleteNode(InputNumber);
             break;
             case 4:
             printf("\nDisplaying node data in forward direction \n");
             DisplayNodeForward();
             break;
             case 5:
             printf("\nDisplaying node data in reverse direction\n");
             DisplayNodeReverse();
             break;
             case 6:
             ReverseNodes();
             break;
             case 7:
             printf("Exiting program\n");
             break;
             default:
             printf("\nIncorrect choice\n");
        }
   } while (choice !=7);
   return 0;
}
advance.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly