main.cpp

来自「包括图、二叉树、链表」· C++ 代码 · 共 29 行

CPP
29
字号
#include <iostream>
#include "stack.h"
using namespace std;
int main()
{
	Stackcopy numbers;
	int n,item;
	cout<<"input the size of numbers:";
	cin>>n;
	cout<<endl;
	cout<<"input the numbers:";
	for(int i=0;i<n;i++){
		cin>>item;
		numbers.push(item);
	}
	cout<<endl;
	cout<<"if the stack is full,return '1',else return '0':"<<numbers.full()<<endl<<endl;
	cout<<"the size of the stack is:"<<numbers.size()<<endl<<endl;
	cout<<"the reversing numbers will be:";
	while (!numbers.empty()) {
	//	numbers.top(item);
		cout <<number.top()<< " ";
		numbers.pop();
	}
	cout<<endl<<endl;
	numbers.clear();
	cout<<"after clear,the size of the stack is:"<<numbers.size()<<endl<<endl;	
	return 0;
}

⌨️ 快捷键说明

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