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

📄 example7_4.cpp

📁 data+structures+using+c的源码
💻 CPP
字号:
#include <iostream>
#include <stack>

using namespace std;

int main()
{
	stack<int>  intStack;					//Line 1

	intStack.push(16);						//Line 2
	intStack.push(8);						//Line 3
	intStack.push(20);						//Line 4
	intStack.push(3);						//Line 5

	cout<<"Line 6: The top element of intStack: "
		<<intStack.top()<<endl;				//Line 6

	intStack.pop();							//Line 7

	cout<<"Line 8: After the pop operation, "
		<<"the top element of intStack: "
		<<intStack.top()<<endl;				//Line 8

	cout<<"Line 9: intStack elements: ";	//Line 9

	while(!intStack.empty())				//Line 10
	{
		cout<<intStack.top()<<" ";			//Line 11
		intStack.pop();						//Line 12
	}

	cout<<endl;								//Line 13

	return 0;
}

⌨️ 快捷键说明

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