0
Delete items>0
#include<iostream> using namespace std; struct Stack { int data; Stack *head; Stack *next; }; void push(int x, Stack *myStk) { Stack* e = new Stack; e->data = x; e->next = myStk->head; myStk->head = e; } int pop(Stack *myStk) { if (myStk->head == NULL) { cout « "stack is empty!" « endl; return -1; } else { Stack *e = myStk->head; int a = myStk->head->data; myStk->head = myStk->head->next; delete e; return a; } } ........................
1 ответ
+ 1
What's the question?