📄 seqstackmain.cpp
字号:
//SeqStackMain.cpp
#include <iostream> //引用输入输出流
using namespace std;
#include "SeqStack.cpp" //引入成员函数文件
void main()
{
SeqStack<int> a; //创建模板类的实例
if (a.Empty( )){
cout<<"栈空,执行入栈操作:"<<endl;
cout<<"对15和10执行入栈操作:"<<endl;
try
{
a.Push(15);
a.Push(10);
}
catch(char* wrong)
{
cout<< wrong;
}
cout<<"栈顶元素为:"<<endl; //取栈顶元素
cout<<a.GetTop( )<<endl;
cout<<"执行出栈操作:"<<endl;
cout<<a.Pop( )<<endl; //执行出栈操作
cout<<"栈顶元素为:"<<endl;
cout<<a.GetTop( )<<endl;
}
else{
cout<<"栈不空"<<endl;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -