A simple stack example



// A simple stack example.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream"
#include "stack"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
       stack<char> stackObject;
       stackObject.push('A');
       stackObject.push('B');
       stackObject.push('C');
       stackObject.push('D');
       while (!stackObject.empty())
       {
             cout << "Popping:";
             cout << stackObject.top() << endl;
             stackObject.pop();
       }
       system("pause");
       return 0;
}


Share on Google Plus