macrofish

nice stack

Jun 23rd, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <stack>
  3.  
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.     stack<int> myS;
  10.     for(int i = 0; i < 10; i++)
  11.     {
  12.         myS.push(i);
  13.     }
  14.  
  15.     cout << "size of myS is: " << myS.size() << endl;
  16.  
  17.     cout << "top of myS is: " << myS.top() << endl;
  18.  
  19.     while(!myS.empty())
  20.     {
  21.         cout << "deleting stack: "<<myS.top()<< endl;
  22.         myS.pop();
  23.     }
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment