#include using namespace std; struct node { int val; node* next; }; bool is_Empty(node*stack); void enqueue(node *&Q,node *&T,int x) { node*p =new node; p->val=x; p->next=NULL; if(Q==NULL) Q=p; else T->next=p; T=p; } void dequeue(node*&Q,node *&T) { if(Q!=NULL) { node *p=Q; Q=Q->next; delete p; } if(Q==NULL) T=NULL; } void showfirst(node* Q) { if(Q!=NULL){ node *p = Q; cout<val; } } void showlast(node* T) { if(T!=NULL){ node *p = T; cout<val; } } bool is_Empty(node*Q) //t-next=new node; t=t-next; t-val=x; t-next=null; - to -> { if(Q==NULL) return true; else return false; } int main() { node* Q = NULL; node* T=NULL; enqueue(Q,T, 2); enqueue(Q,T, 5); //zad przerzucanie stosu na kolejke (co 2 element )// //zadanie 2 przerzucanie z kolejki na stos (co 2 element ) cout << "gora kolejki"; showfirst(Q); enqueue(Q,T, 6); dequeue(Q,T); cout< using namespace std; struct node { int val; node* next; }; bool is_Empty(node*stack); void enqueue(node *&Q,node *&T,int x) { node*p =new node; p->val=x; p->next=NULL; if(Q==NULL) Q=P; else T->next=P; T=P; } void dequeue(node*&Q,node *&T) { if(Q!=NULL) { node *p=q; Q=Q->next; delete p; } if(Q==NULL) T=NULL; } void showfirst(node* Q) { if(Q!=NULL){ node *p = Q; cout<val; } } bool is_Empty(node*Q) //t-next=new node; t=t-next; t-val=x; t-next=null; - to -> { if(Q==NULL) return true; else return false; } void push(node*&stack, int x) { node* p = new node; p->val = x; p->next = stack; stack = p; } int pop(node *stack) { if(is_Empty) { cout<<"stos jest pusty"; } else { node*p=stack; return (p->val); } } void showtop(node *stack) { if(stack!=NULL){ node *p = stack; cout<val; } } bool is_Empty(node*stack) //t-next=new node; t=t-next; t-val=x; t-next=null; - to -> { if(stack==NULL) return true; else return false; } int main() { node* stack = NULL; push(stack, 2); push(stack, 5); //zadanie masz na telefonie push(stack, -6); cout << "gora stosu"; showtop(stack); //cout << "po" << endl; //del(head); //show(head); system("pause"); }