if(!a.pop(x))
cout<<"空";
else a.push(x);
while(a.pop(x))
{cout<<x<<" ";}
cout<<endl;
cout<<"大于等于60小于100的整数"<<endl;
if(!b.pop(x))cout<<"空";
else b.push(x);
while(b.pop(x))
{cout<<x<<" ";}
cout<<endl;
cout<<"大于100的整数"<<endl;
if(!c.pop(x))cout<<"空";
else c.push(x);
while(c.pop(x))
{cout<<x<<" ";}
cout<<endl;
return 0;
}
2题:
#include<iostream.h>
#include<assert.h>
#include<stdlib.h>
#include<time.h>
template<class t1>
struct quenenode{
t1 data;
quenenode *next;};
template<class t1>
class linkquene{
quenenode<t1> *head,*tail;
unsigned qsize;
public:
linkquene();
~linkquene()
{clear();}
void clear();
void pushtail(t1 &x);
bool popfront(t1 &x);
bool isempty()
{return(qsize==0)?true:false;}
};
template<class t1>
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库数据结构实验报告 堆栈和队列(4)在线全文阅读。
相关推荐: