E2(b)

来源:互联网 发布:大数据展示平台源码 编辑:程序博客网 时间:2024/05/21 08:38

#include<stack>

#include<iostream>

using namespace std;

#include"Stack.h"

const int maxstack=32;

enum Error_code{success,overflow,underflow};

typedef int Stack_entry;

class Stack{

bool empty() const;

Error_code copy_stack(Stack&dest,Stack&source);

private:

int count;

Stack_entry[maxstack];

};

bool Stack::copy_stack(Stack&dest,const Stack&source)

{

Error_code outcome=success;

if(0==count)

outcome=underflow;

else if(count>=maxstack)

outcome=overflow;

else

source==dest;

entry[count++]=dest;

return dest;}