statck和queue

简单功能模仿:

stack:

函数实现

void stack()

{

   int stcak[10];

   int top=0;

while(top<10)

  stack[top++]=top;

 while(top>0)

  cout<<stack[--top]<<"  ";

}

queue:

函数实现

void queue()

{

  int queue[10];

 int front=0,rear=0;

queue[rear++]=1;

queue[rear++]=2;

while(front<rear)

 cout<<queue[front++]<<" " ;

}

posted @ 2010-10-28 07:18  hailong  阅读(232)  评论(0编辑  收藏  举报