#include "malloc.h"
#include "iostream"
using namespace std;
#define STACKINCREMENT 10
#define STACK_INIT_SIZE 10
class stack {
public :
int * base;
int * top;
int stacksize;
bool initStack()
{
base = (int *)malloc(STACK_INIT_SIZE * sizeof(int));
if(!base) return false; /*分配空间失败*/
top = base;
stacksize = STACK_INIT_SIZE;
return true; /*初始化栈成功*/
}
bool Push(int e) {
if(top - base >= stacksize){
/*栈满,追加空间*/
base = (int *)realloc(base, (stacksize +
STACKINCREMENT)*sizeof(int));
if(!base) return false; /*存储分配失败*/
top = base + stacksize;
stacksize = stacksize + STAC