#include using namespace std; #include "Stack.h" int main() { Stack S(4); S.print(); cout << endl; S.push(2.31); S.push(1.19); S.push(6.78); S.push(0.54); S.print(); cout << endl; if (!S.full()) S.push(6.7); // this should do nothing, as // stack is already full. S.print(); cout << endl; cout << "Popped value is: " << S.pop() << endl; S.print(); cout << endl;; S.push(S.pop() + S.pop()); cout << "Replace top two items with their sum: \n"; S.print(); cout << endl; S.pop(); S.pop(); S.print(); cout << endl; if (!S.empty()) S.pop(); // this should also do nothing, // as stack is already empty. if (S.num_items() != 0) { cout << "Error: Stack is corrupt!" << endl; } return 0; // destructor for S automatically called }