-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLift.h
More file actions
46 lines (35 loc) · 1011 Bytes
/
Copy pathLift.h
File metadata and controls
46 lines (35 loc) · 1011 Bytes
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
#ifndef LIFT_H
#define LIFT_H
#include<stdio.h>
#include<stdlib.h>
//delaration of person info data struct
typedef struct person_info
{
int time_arrival;
int floor_arrival;
int floor_dest;
struct person_info* mainnext;
struct person_info* next;
int lift;//The lift number by which he is picked up
int time;//The time of picking up
}person;
//declaration of a queue
typedef struct pqueue_
{
person* head;
person* tail;
}pqueue;
//function for the creation of a person's information.
person * person_new(int time_arrival, int floor_arrival,
int floor_dest, person* next, person * mainnext);
//function for creating a new queue.
pqueue * pqueue_new();
//pushing an element into the queues mq and q
int pqueue_push(pqueue * q, pqueue * mq, person * p);
//popping an element from the elevator list
int pqueue_pop_ele(pqueue * q, pqueue * mq, person * p);
//printing the queue for a floor.
void pqueue_print(pqueue * q);
//printing out the main queue.
void mpqueue_print(pqueue * q);
#endif