// @topic T00590 Project 1/Part 1, Stack of integers // @brief main driver for testing your solution. // Use this main driver to test your solution. It should generate // sample output similar to the one shown at the bottom of this file. #include <iostream> #include "intstack.h" int main() { IntStack stack; stack.reset(); std::cout << "pushing 11\n"; stack.push(11); std::cout << "is_empty: " << stack.is_empty() << "\n"; std::cout << "top: " << stack.top() << "\n"; std::cout << "pop: " << stack.pop() << "\n"; std::cout << "is_empty: " << stack.is_empty() << "\n"; std::cout << "pop: " << stack.pop() << "\n"; // this should result in "STACK EMPTY" output, or similar message std::cout << "pop: " << stack.pop() << "\n"; // this should result in "STACK EMPTY" output, or similar message std::cout << "is_empty: " << stack.is_empty() << "\n"; std::cout << "pushing 1\n"; stack.push(1); std::cout << "pushing 2\n"; stack.push(2); std::cout << "pushing 3\n"; stack.push(3); std::cout << "pushing 4\n"; stack.push(4); std::cout << "pop: " << stack.pop() << "\n"; std::cout << "pop: " << stack.pop() << "\n"; std::cout << "top: " << stack.top() << "\n"; std::cout << "pop: " << stack.pop() << "\n"; std::cout << "stack size: " << stack.size() << "\n"; stack.reset(); int arr[] = {0, 1, 2, 3, 4}; stack.push(arr, 5); print_stack(&stack); stack.pop(arr, 5); std::cout << "stack size: " << stack.size() << "\n"; for(int i = 0; i < 5; ++i) { std::cout << arr[i] << "\n"; } return 0; } /* The above program should generate output as follows: pushing 11 is_empty: 0 top: 11 pop: 11 is_empty: 1 STACK EMPTY pop: 0 STACK EMPTY pop: 0 is_empty: 1 pushing 1 pushing 2 pushing 3 pushing 4 pop: 4 pop: 3 top: 2 pop: 2 stack size: 1 0 1 2 3 4 stack size: 0 4 3 2 1 0 */