链栈

//#include<iostream>
//using namespace std;
//class Link
//{ 
//
//   Link *top;
//   int data;
//   Link *next;
//public:
//   Link* InitLink(Link *top);
//   void InsertLink(Link * top,int x);
//   void DeleteLink(Link *top);
//   int Gettop(Link *top);
//   bool EmptyLink(Link *top);
//};
//Link *top,link;
//Link *Link::InitLink(Link *top)
//{   link.top=new Link;
// link.top->next=NULL;
// return link.top;
//}
//
//void Link::InsertLink(Link *top, int x)
//{
//   Link *s;
//   s=new Link;
//   s->data=x;
//   s->next=top->next;
//   top->next=s;
//}
//
//void Link::DeleteLink(Link *top)
//{
//   Link *p;
//   p=top->next;
//   while(p)
//   {
//     top->next=p->next;
//  delete(p);
//   }
//}
//
//int Link::Gettop(Link *top)
//{
//   if(top->next==NULL)
//    return NULL;
//   else
//    return top->next->data;
//}
//
//bool Link::EmptyLink(Link *top)
//{
//   if(top==NULL)
//    return true;
//   else
//    return false;
//}
//void main()
//{
// /* Link link;
//  Link *top=NULL;
//  int data;
//  cout<<"链栈的初始化"<<endl;
//  cin>>data;
//  link.InitLink(top);
//  cout<<"链栈的插入"<<endl;
//  cout<<"输入要插入的元素"<<endl;
//  cin>>data;
//  link.InsertLink(top,2);
//  cout<<"链栈的删除"<<endl;
//  cout<<"输入要删除的元素"<<endl;
//  cin>>data;
//  link.DeleteLink(top);
//  cout<<"链栈的取栈顶元素"<<endl;
//  link.Gettop(top);
//  cout<<"链栈的判断"<<endl;
//  link.EmptyLink(top);*/
//   top = link.InitLink(top);
// link.InsertLink(top,3);
// cout<<link.Gettop(top);
// link.DeleteLink(top);
// cout<<link.EmptyLink(top)<<endl;
//}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值