#include #include "stack.h" #include using namespace std; int main() { ifstream in("input.txt"); ofstream out("output.txt"); Stack getNumb; int i, x; cin >> x; while (in >> i) { getNumb.Push(i); } while (!getNumb.Empty()) { if (x != getNumb.Top()) out << getNumb.Top() << " "; getNumb.Pop(); } in.close(); out.close(); return 0; } using namespace std; template class Stack { private: struct Element { Item inf; Element *next; Element(Item x, Element *p) : inf(x), next(p) {} }; Element *head; public: Stack() : head(0) {} bool Empty() { return head == 0; } Item Pop() { if (Empty()) { return 0; } else { Element *r = head; Item i = r->inf; head = r->next; delete r; return i; } } void Push(Item data) { head = new Element(data, head); } Item Top() { if (Empty()) { return 0; } else { return head->inf; } } };