// stack.cpp : 定义控制台应用程序的入口点。
//stack 栈,LIFO(后进先出)形式
//VS2010编译通过
#include "stdafx.h"
#include <stdlib.h>
#include <stack>
#include <string>
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
cout<<"--------stack test--------------"<<endl<<endl;
stack<string> stackStr;
stackStr.push("张三");
stackStr.push("李四");
stackStr.push("王五");
cout<<"当前栈内总数:"<<stackStr.size()<<endl;
while (!stackStr.empty())
{
cout<<stackStr.top()<<endl;
stackStr.pop();
}
cout<<"当前栈内总数:"<<stackStr.size()<<endl;
system("pause");
return 0;
}