diff options
Diffstat (limited to 'structures/task5.cpp')
| -rw-r--r-- | structures/task5.cpp | 33 |
1 files changed, 2 insertions, 31 deletions
diff --git a/structures/task5.cpp b/structures/task5.cpp index 72e1381..f182625 100644 --- a/structures/task5.cpp +++ b/structures/task5.cpp @@ -1,36 +1,7 @@ #include <iostream> -using namespace std; - -struct stack -{ - int inf; - stack *next; -}; +#include "stack.h" -void push(stack *&h, int x) -{ - stack *r = new stack; - r->inf = x; - r->next = h; - h = r; -} - -int pop(stack *&h) -{ - int i = h->inf; - stack *r = h; - h = h->next; - delete r; - return i; -} - -void reverse(stack *&h) -{ - stack *head1 = NULL; - while (h) - push(head1, pop(h)); - h = head1; -} +using namespace std; stack *result(stack *&h) { |