view algs4-c++/src/ResizingArrayStack.cpp @ 18:a149b424b4e2

Updated all template classes to have the implementaiton in the header file.
author Eris Caffee <discordia@eldalin.com>
date Sat, 20 Jun 2015 19:36:11 -0500
parents 3db1a894bbdf
children
line source
1 // g++ -std=c++11 ResizingArrayStack.cpp
4 #include "ResizingArrayStack.hpp"
6 #include <iostream>
8 int main ( int argc, char **argv ) {
10 ResizingArrayStack<long> stack;
12 long i;
13 while ( ! std::cin.eof() ) {
14 std::cin >> i;
15 if ( std::cin.good() )
16 stack.push(i);
17 }
19 std::cout << "Stack has " << stack.size() << " entries." << std::endl;
21 for ( auto iter = stack.begin(); iter != stack.end(); ++iter ) {
22 std::cout << *iter << std::endl;
23 }
25 std::cout << "Popping entries..." << std::endl;
27 while ( ! stack.is_empty() ) {
28 i = stack.pop();
29 std::cout << i << std::endl;
30 }
32 std::cout << "Stack has " << stack.size() << " entries." << std::endl;
34 }