Question: Answer exp 4 using the following code please Experiment 4 (PreLab task-to be prepared in advance by the student) (to write a COMPLETE C program)

Answer exp 4 using the following code please  Answer exp 4 using the following code please Experiment 4 (PreLab
task-to be prepared in advance by the student) (to write a COMPLETE
C program) Prepare a menu driven C program for Inserting and deletion

Experiment 4 (PreLab task-to be prepared in advance by the student) (to write a COMPLETE C program) Prepare a menu driven C program for Inserting and deletion operation for a queue structure of employee information which has the following structure declaration. Structure of a queue will be defined as follows. struct person { int empNo; char name[12]; int age; char gender[2];/* M=male, F=Female */ }; struct queue struct person allperson[15]; int front, rear; }; Define the following Initialized array of structure in your program. sruct person ten Person[10]={123,"Ahmet", 21, "M", 234,"Sevgi", 26, "F", 128,"Osman", 18,"M", 432,"Mert",27,"M", 287,"Ayse",34,"F" ,423,"Kemal", 21, "M",634, "Lale", 16, "F", 828,"Sefer", 15,"M", 252,"Meral", 27,"F", 887,"Demet",34,"F"}; Following steps of operations will take place in your menu driven program. 1. Create a Circular queue using tenPerson array structure(copy from array into queue will be done). 2. Delete all the elements of queue and list all the deleted from the monitor. 3. Using circular queue which is populated at step 1, Create two new circular queues, one for Male and one for Female employees. These new queues will be created during the deletion of circular queue and use gender fields for determining Male(M) and Female(F) queues. 4. List the content of Male queue and Female queue during delete operation of each queue. 5. End of operation 0 231Lab5n3.cpp int age; 231 Lab5n3.cpp 8 #include 9 #include 10 #include 11 #define MAXELEMENTS 5 12 #define TRUE 1 13 #define FALSE O I 14 // circular Queue insertion and deletion functions 15 //created for person 16 struct person 17 { 18 int empNo; 19 char name (12); 20 21 char gender [21;/* M=male, F=Female */ 22 }; 23 24 //the new queue, this queue takes "person" 25 struct queue 26 { 27 struct person allperson (15); 28 int front, rear; 29 }; 30 31 //the prototypes will change, input to queue is struct person, output 32 33 int main(void) 34 35 char operation; 36 int x; 37 struct queue 9, male, female; 38 q. front = q.rear = MAXELEMENTS - 1; 39 struct person tenPerson (10)={123, "Ahmet", 21, "M", 41 234, "Sevgi", 26, "F", 128,"Osman", 18, "M", 432, "Mert", 27,"M", 42 287,"Ayse", 34,"F", 423,"Kemal", 21, "M",634, "Lale", 16, "F", 43 828, "Sefer", 15,"M", 252, "Meral",27,"F", 887,"Demet", 34, "F"): 44 do { 40 45 231 Lab5n3.cpp 72 printf("s ", "Insert Operation type ID or E "); 73 scanf(" %c",&operation); 74 switch (operation) 75 { 76 case 'I': printf("s ", "Insert an element"); 77 scanf(" %d",&x); 78 cqinsert(&q, x); 79 break; 80 case 'D':x=cadelete(&q); 81 printf(" *d is deleted ",x); 82 break; 83 } 84 } 85 while (operation != 'E'); 86 return ; 87 } 88 89 90 int empty(struct queue *pg) 91 return((pq->front == pq->rear) ? TRUE : FALSE); 93 } 94 95 //output from queue is struct person 96 struct person cqdelete(struct queue *pg) 97 { 98 if (empty(pq)) { 99 printf("Queue underflow "); 100 exit(1); 101 102 if (pq->front -- MAXELEMENTS - 1) 103 pq->front - ; 104 else 105 (pq->front)++; 106 return(pq->items (pq->front]): 107 } 108 109 //input to queue is struct person 110 void cinsert(struct queue *pq, int x) 92

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!