diff options
Diffstat (limited to 'structures/task5.cpp')
| -rw-r--r-- | structures/task5.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/structures/task5.cpp b/structures/task5.cpp index f182625..56bcb17 100644 --- a/structures/task5.cpp +++ b/structures/task5.cpp @@ -3,7 +3,7 @@ using namespace std; -stack *result(stack *&h) +void solve(stack *&h) { stack *tmp = NULL; stack *res = NULL; @@ -26,7 +26,7 @@ stack *result(stack *&h) push(res, elem); } - return res; + h = res; } int main() @@ -42,9 +42,10 @@ int main() push(head, int(x)); } reverse(head); - stack *res = result(head); - while (res) - cout << char(pop(res)) << " "; + + solve(head); + while (head) + cout << char(pop(head)) << " "; cout << endl; return 0; |