#include <iostream.h>
using namespace std;
struct Stack{
int data;
Stack *next;
};
struct Stacklist{
Stack *head;
Stack *base;
};
void Inital(Stacklist &list)
{
list.head=list.base=NULL;
}
void Push(Stacklist &list,int e)
{
Stack *node=new Stack;
if(!node)return;
node->data=e;
if(list.base==NULL){
list.base=node;
}
node->next=list.head;
list.head=node;
}
void Pop(Stacklist &list,int &e)
{
if(list.base=NULL)return;
Stack *p=list.head;
e=p->data;
list.head=list.head->next;
delete p;
}
int Peek(Stacklist list)
{
if(list.base=NULL)return 0;
return list.head->data;
}
void DeleteStack(Stacklist &list)
{
Stack *p,*q=list.head;
while(q)
{
p=q->next;
delete q;
q=p;
}
list.head=list.base=NULL;
}
void Print(Stacklist list)
{
Stack *p=list.head;
while(p)
{
cout<<p->data<<" ";
p=p->next;
}
cout<<endl;
}
void main()
{
Stacklist list;
Inital(list);
Push(list,100);//现在只输入一个
Print(list);
}