⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 seqstackmain.cpp

📁 数据结构算法集C++版.好东西大家一起分享。
💻 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 + -