Page 121 - DCAP407_DATA_STRUCTURE
P. 121

Data Structure



                                            {
                                            case 1:
                                            printf ("\n\n Enter the number of nodes you wish to add:");
                                            scanf ("%d",&n);
                                            for(i = 0;i<n;i++)
                                            {
                                            printf ("\nEnter the element:");
                                            scanf ("%d",&m);
                                            createlist(m);
                                            }
                                            break;
                                            case 2:
                                            if (START == NULL)
                                            {
                                            printf("\n\n List is empty");
                                            continue;
                                            }
                                            printf ("\n\n Enter the element for deletion:");
                                            scanf ("%d",&m);
                                            delete(m);
                                            break;
                                            case 3:
                                            Display();
                                            break;
                                            case 4:
                                            exit(0);
                                            default:
                                            printf ("\n\nWrong choice");
                                            }
                                            }
                                            }

                                            Output:
                                            When you run the program, the following output is obtained:
                                            1.   Create List
                                            2.   Delete element

                                            3.   Display
                                            4.   Exit
                                            Enter your choice:1
                                            Enter the number of nodes you wish to add: 4
                                            Enter the element: 10 20 30 40
                                            1.   Create List
                                            2.   Delete element
                                            3.   Display

                                            4.   Exit
                                            Enter your choice: 2
                                            Enter the element for deletion: 40
                                            1.   Create List
                                            2.   Delete element




                          114                     LOVELY PROFESSIONAL UNIVERSITY
   116   117   118   119   120   121   122   123   124   125   126