#include <stack>
#include <iostream>
int main ()
{
using namespace std;
stack <int> stackIntegers;
stackIntegers.push (25);
stackIntegers.push (10);
stackIntegers.push (-1);
stackIntegers.push (5);
cout << stackIntegers.size () << " elements";
while (stackIntegers.size () != 0)
{
cout << stackIntegers.top();
stackIntegers.pop ();
}
if (stackIntegers.empty ())
cout << endl << "The stack is now empty!";
return 0;
}
|