text cover

Data Abstraction and Problem Solving with C++

Walls and Mirrors

by Frank M. Carrano

Addison Wesley Logo

example313.cpp

Go to the documentation of this file.
00001 
00015 #include <iostream>
00016 #include <stack>
00017 using namespace std;
00018 
00019 int main()
00020 {
00021    stack<int> aStack;
00022 
00023    // Right now, the stack is empty
00024    if (aStack.empty())
00025       cout << "The stack is empty" << endl;
00026 
00027    for (int j = 0; j < 5; j++)
00028       aStack.push(j); // places items on top of stack
00029 
00030    while (!aStack.empty())
00031    {
00032       cout << aStack.top() << " ";
00033       aStack.pop();
00034    }  // end while
00035    return 0;
00036 }  // end main

Generated on Sun Aug 27 16:41:03 2006 for AWLogo by  doxygen 1.4.6