编辑代码

#include <iostream>
using namespace std;
typedef struct LinkNode{
    int data;
    struct LinkNode* next;
}LinkNode;
typedef struct{
    LinkNode* head,end;
}LinkQueue;
void InitQueue(LinkQueue &Q){
    Q.head=Q.end=(LinkNode*)malloc(sizeof(LinkNode));
    Q.head->next=NULL;
}
void EnQueue(LinkQueue &Q,int x){
    LinkNode *s=(LinkNode*)malloc(sizeof(LinkNode));
    s->data=x;
    head->next=s;
    s->next=NULL;
    end=s;
}
void Queue(LinkQueue &Q,int x){
    if(head==end)
    return false;
    LinkNode *p=head->next;
    x=p->data;
    head->next=p->next;
    p->next=NULL;
    if(end==p)//如果原队列中只有一个结点
    Q.head=Q.end;
    free(p);
}
bool IsEmpty(LinkQueue Q){
    if(head==end)
    return true;
    else
    return false;
}
int main() {
    LinkQueue Q;
    InitQueue(Q);
	return 0;
}