#include <stdio.h>
#include <stdlib.h>
#include <stdfix.h>
typedef int ElementType
;
typedef int Position
;
typedef struct QNode
{
ElementType
*Data
;
Position front
,rear
;
int MaxSize
;
};
typedef struct QNode
* Queue
;
Queue
Create_Queue(int size
)
{
Queue Q
;
Q
=(Queue
) malloc(sizeof(struct QNode
));
Q
->Data
=(ElementType
)malloc(sizeof(ElementType
)*size
);
Q
->front
=Q
->rear
=0;
Q
->MaxSize
=size
;
return Q
;
}
bool
IsFull(Queue Q
)
{
return ((Q
->rear
+ 1)%(Q
->MaxSize
) ==Q
->front
);
}
bool
AddQ(Queue Q
)
{
if(IsFull(Q
)){
printf("Queue is Full");
return EXIT_FAILURE
;
}
}
int main() {
int n
,m
,x
,i
,j
;
scanf("%d%d",&n
,&m
);
Create_Queue();
for (int i
= 0; i
< n
; ++i
) {
scanf("%d",&x
);
insert(x
);
}
printf("Hello, World!\n");
return 0;
}
转载请注明原文地址: https://mac.8miu.com/read-495313.html