📄 stack.cpp
字号:
// Stack.cpp: implementation of the CStack class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "CStackOperation.h"
#include "Stack.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CStack::CStack()
{
S.top = -1;
}
CStack::~CStack()
{
}
void CStack::Push(char x)
{
if(S.top==Maxsize-1)
{
AfxMessageBox("栈溢出!");
}
S.top++;
S.elements[S.top] = x;
}
char CStack::Pop()
{
if(S.top==-1)
{
AfxMessageBox("栈空,括号不匹配!");
}
S.top--;
return S.elements[S.top + 1];
}
void CStack::Clear()
{
S.top = -1;
}
BOOL CStack::IsEmpty()
{
return (S.top == -1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -