forked from Ayush-chhabra/Hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathF19.CPP
More file actions
90 lines (73 loc) · 1.13 KB
/
F19.CPP
File metadata and controls
90 lines (73 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
struct queue
{
int eno;
float salary;
queue*field;
}*front=NULL,*rear;
void insert(int,float);
void delnode();
void main()
{
clrscr();
int ch,a,sal;
do
{
cout<<"\n\n1.PUSH";
cout<<"\n2.POP";
cout<<"\n3.EXIT";
cout<<"\n enter your choice:";
cin>>ch;
switch(ch)
{
case 1:cout<<"\nEnter employ number to insert:";
cin>>a;
cout<<"\nEnter employ salary to insert:";
cin>>sal;
insert(a,sal);
break;
case 2:delnode();
break;
case 3:exit(0);
}
}while(ch!=3);
getch();
}
void insert(int no,float sal)
{
queue*ptr;
ptr=new queue;
ptr->eno=no;
ptr->salary=sal;
ptr->field=NULL;
if(front==NULL)
{
rear=ptr;
front=ptr;
}
else
{
rear->field=ptr;
rear=ptr;
}
}
void delnode()
{
int p,q;
queue*ptr;
if(front==NULL)
{
cout<<"\nQueue is Underflow!!!\n";
return;
}
p=front->eno;
q=front->salary;
ptr=front;
front=front->field;
delete ptr;
cout<<"\n\n\t\t*****DELETED NODE*****\n";
cout<<"\nEmployee no:"<<p;
cout<<"\nEmployee salary:"<<q;
};