/
QUEUE.C
59 lines (56 loc) · 798 Bytes
/
QUEUE.C
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
#include<stdio.h>
#include<conio.h>
int size=0;
int a[100];
void enq(int no)
{
//int no;
a[size++]=no;
// return size;
}
void deq()
{
int i;
for(i=0;i<size;i++)
{
a[i]=a[i+1];
}
size--;
}
void disp()
{
int i;
for(i=0;i<size;i++)
printf("\t%d",a[i]);
}
void main()
{
int x,c,ch,no;
//int que[100];
clrscr();
do
{
printf("\n1.Enqueue\n2.Dequeue : ");
scanf("%d",&x);
if(x==1)
{
if(size==99)
printf("\nStack is full...") ;
else
{
printf("\nEnter the number : ");
scanf("%d",&no);
enq(no);
}
// disp(que,size);
}
else
{
deq();
}
disp();
printf("\nDo u wnt to conti ? 1.yes 2.no");
scanf("%d",&ch);
}while(ch!=2);
getch();
}