#include #include using namespace std; #include "stack.h" int main() { cout << "To hire a person, type their social security number.\n" "To fire the most recently hired person, type a zero.\n" "To quit, type control-d.\n\n"; for (stack s;;) { //Keep s alive as long as we're in the loop. int ss {0}; //social security number cin >> ss; if (!cin) { //The user typed control-d break; //out of the for loop } if (ss > 0) { //hire s.push(ss); } else { //fire cout << "Firing number " << s.pop() << ".\n"; } } //Destruct s at this point. return EXIT_SUCCESS; }