Question: Experiment 1 (PreLab task to be prepared in the lab) 1.1) Examine and test the below menu driven program for Insertion (I) and Deletion (D)

 Experiment 1 (PreLab task to be prepared in the lab) 1.1)

Examine and test the below menu driven program for Insertion (I) and

Experiment 1 (PreLab task to be prepared in the lab) 1.1) Examine and test the below menu driven program for Insertion (I) and Deletion (D) operation using stack structure. #include #include #include #include #define STACKSIZE 5 struct stack { int items [STACKSIZE]; int top; void push(struct stack * ,int); int pop (struct stack *); void main(void) { struct stack s; int xx; char optype; s.top=-1; do { printf ("Enter Operation type "); scanf(" %c", &optype); switch (optype) { case 'I': printf ("ENTER input Number "); scanf("%d",&xx); push(&s, xx); break; } case 'D':{ printf("%d %s", pop (&s)," is deleted "); break; } default .printf("%s", "Illegal Oparation code "); } }while (optype!='E'); } int pop (struct stack *ps) (int x; if (ps->top==-1) printf("%s","stack underflow"); exit(1); } else x=ps->items (ps->top]; ps-top-ps->top - 1; } return x; } void push(struct stack *ps, int x) if (ps->top == STACKSIZE-1) { printf("s","stack overflow "); exit(1); ) else! ps->top-ps->top + 1;// ++ (ps->top) ps->items [ps->top]=x; 1.2 )Using below structure write the same menu driven Insertion/Deletion main program, Push() and Pop() functions. struct person { int empnr; char name[12]; int age; }; struct stack { struct person items[6]; int top; }; Use the following input data(empnr, name, age) for your menu driven program 123 ALI 25 345 AYSE 22 1 D E Your program will display empnr, name and age when you call POP() function each time

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!