C语言上机考试系统源代码(用VS编写的)急需,哪位好心人帮帮忙,请发到我的邮箱里,我将不胜感激继续加分

chuchujava@foxmail.com
2024-12-12 18:24:11
推荐回答(1个)
回答1:

#define N 10
typedef int T;

struct stack
{
T item[N];
int top;
public:
stack() //生成栈
void Cls() //清空栈
bool IsEmpty() //判空栈
bool push(T itm) //入栈
{
if(top == N - 1)
return false;
else
{
item[++top] = itm;
return true;
}
}
bool pop(T& itm) //出栈
{
if(top != -1)
{
itm = item[top--]; return true;
}
else
return false;
}
}