test_smart_stack

test_smart_stack - #include"smart_stack.h#include...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#include "smart_stack.h" #include <iostream> #include <vector> using namespace std; using namespace csci180; //------------------------------ do not change this portion ----------------------- template<typename Item_Type> int SmartStack<Item_Type>::total=0; // needed for accounting cout << "stack dump: " << original.dump() << endl;; } void printCount() { cout << "Number of allocated nodes is " << SmartStack<string>::getTotalNumNodes() << endl << endl; } //--------------------------------------------------------------------------------- void test() { SmartStack<string> r; r.push("X"); r.push("Y"); r.push("Z"); cout << "r "; printStack(r); printCount(); // Figure 0 // enter new scope so that s can be constructed and later destructed if (true) { SmartStack<string> s; s.push("A"); s.push("B"); s.push("C"); s.push("D"); cout << "r "; printStack(r); cout << "s "; printStack(s); printCount(); // Figure 1 // enter new scope so that t can be constructed and later destructed
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 2

test_smart_stack - #include"smart_stack.h#include...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online