- 5
- 0
- 约2.76万字
- 约 14页
- 2016-08-29 发布于贵州
- 举报
实验1 数据结栈和队列的实现和应用
实验1 栈和队列的实现和应用
实验目的
1.熟练掌握栈、队列的建立方法;
2.熟练掌握栈和队列基本操作;
3.栈和队列的实例应用 。
实验内容
1.选用一种存储结构建立栈、队列
2.栈的应用:A desk calculation(教科书P66)
3.队列验证:Menu-driven demonstration(教科书上P93)
实验结果
总结算法应用和结构优缺点
栈:
#include iostream
using namespace std;
const int maxstack = 100;
enum Error_code {success = 1, overflow = -1, underflow = -1};
typedef int Stack_entry;
class Stack
{
public:
Stack()
{
count = 0;
}
bool empty();
Error_code pop();
Error_code top(Stack_entryitem);
Error_code push(const Stack_entry item);
int size();
private:
int count;
Stack_en
原创力文档

文档评论(0)