-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathPrintermanagement
64 lines (53 loc) · 1.08 KB
/
Printermanagement
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
#include <iostream>
#include<stdlib.h>
using namespace std;
struct Node {
int data;
Node* next = NULL;
};
struct Queue {
Node *front= NULL, *rear = NULL;
void enQueue(int x)
{
Node* temp = new Node;
temp->data = x;
if (rear == NULL) {
front = rear = temp;
return;
}
rear->next = temp;
rear = temp;
}
void deQueue()
{
if (front == NULL)
return;
Node* temp = front;
front = front->next;
if (front == NULL)
rear = NULL;
free(temp);
}
};
void display(Node * p)
{
while(p!=NULL)
{
printf("Printing the document of person with user id = %d\n",p->data);
p=p->next;
}
}
int main()
{
Queue q;
int x;
int choice;
do{
printf("enter your id (integer)\n");
scanf("%d",&x);
q.enQueue(x);
printf("\nDo you want to use the printer?1: YES \n");
scanf("%d",&choice);
}while(1==choice);
display((q.front));
}