#include "stdafx.h"
#include <iostream>
#include <stack>
using namespace std;
int main(int argc, _TCHAR* argv[])
{
stack<int> st;
st.push(1);
cout << "Pushed: " << st.top() << endl;
st.push(2);
cout << "Pushed: " << st.top() << endl;
st.push(3);
cout << "Pushed: " << st.top() << endl << endl;
while (!st.empty())
{
cout << "Emptying..." << endl;
st.pop();
}
//cout << "Stack top now: " << st.top() << endl;
}
#include <iostream>
#include <stack>
using namespace std;
int main(int argc, _TCHAR* argv[])
{
stack<int> st;
st.push(1);
cout << "Pushed: " << st.top() << endl;
st.push(2);
cout << "Pushed: " << st.top() << endl;
st.push(3);
cout << "Pushed: " << st.top() << endl << endl;
while (!st.empty())
{
cout << "Emptying..." << endl;
st.pop();
}
//cout << "Stack top now: " << st.top() << endl;
}
No comments:
Post a Comment