麻烦高手帮忙改一下感激不尽
#include
#define null 0
using namespace std;
struct qnode
{
int data;
qnode *next;
}linkqlist;
struct linkqueue
{
linkqlist *front;
linkqlist *rear;
};
void create(linkqueue *p)
{
p->front=new qnode;
p->rear=p->front;
p->font->next=null;
}
int enqueue(linkqueue *p,int e)
{
p->rear->next=new qnode;
p->rear=p->rear->next;
p->rear->data=e;
p->rear->next=null;
}
void display(linkqueue *p)
{
linkqueue *q;
q=p->front->next;
cout<<"show the linklist!!"<<'\t';
if(p->front==p->rear)
cout<<"the linklist is empty!";
else
{
while(q)
{
cout<data;
q=q->next;
}
}
cout<}
void main(linkqueue *head)
{
int n,a,k;
cout<<"create a linkqueue"< create(head);
cout<<"enter the linklist lenght!";
cin>>n;
cout< for(int i=1;i<=n;i++)
{
cin>>a;
enqueue(head,a);
}
display(head);
cout<<"inserter the number!";
cin>>k;
enqueue(head,k);
display(head);
}
--------------------next---------------------
阅读(1039) | 评论(0) | 转发(0) |