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

📄 debug_stack.cpp

📁 这是栈的顺序实现方法,适合数据结构的初学者参考.
💻 CPP
字号:
#include"Stack.h"
#include<windows.h>

void main()
{

	char choose = '5';
	Stack_entry item;
	Stack try_stack;
    
	cout << "1.push" << endl
			 << "2.pop" << endl
			 << "3.empty" << endl
			 << "4.top" << endl
			 << "5.quit" << endl;
	while (1)
	{
		//system("cls");  不用刷屏更好!
		
		cin >> choose;
		/*system("cls");*/

		switch (choose)
		{
		case '1' :
			cout << "item:";
			cin >> item;
			if (try_stack.push(item)==overflow)
			{
				cout << "stack is overflow";
				system("pause");
			}
			continue;break;

		case '2':
			if (try_stack.pop()==underflow)
			{
				cout << "stack is empty";
				system("pause");
			}
			continue;break;

		case '3':
			if (try_stack.empty())
				cout << "stack is empty";
			else cout << "stack is not empty";
			system("pause");
			continue;break;

		case '4':
			if (try_stack.top(item)==underflow)
				cout << "stack is empty";
			else cout << "stack's top is:" << item;
			system("pause");
			continue;break;	
			
		case '5':
			return;

		default: continue;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -