#include #include #include "stack_solution.h" #include "stack_solution.h" // test inclusion guard void test_const(Stack const& s) { s.empty(); } void try_pop_empty(Stack& s) { try { s.pop(); } catch (std::exception& e) { std::cerr << e.what() << std::endl; } } int main() { Stack s; std::string name; try_pop_empty(s); while ( std::cin >> name ) { s.push(name); } while ( ! s.empty() ) { std::cout << s.pop() << ' '; } try_pop_empty(s); for (int i{0}; i < 5; ++i) { s.push("The devil is in the detail."); s.pop(); } try_pop_empty(s); return 0; }