赞
踩
一、栈的定义
二、初始化
#include<iostream> using namespace std; const int N = 10; typedef struct { int data[N]; int top; }SqStack; void InitSqStack(SqStack &S)//初始化 { S.top = -1; }三、进栈
void Push(SqStack& S, int x)//入栈 { S.data[++S.top] = x; }四、出栈
void Pop(SqStack& S, int& x)//出栈 { x = S.data[S.top--]; }五、读栈
void Read(SqStack& S, int& x)//读栈 { x = S.data[S.top]; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。