Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct nodo{int info; nodo* next; nodo(int a=0, nodo* b=0){info=a; next=b;}};
- struct FIFO{nodo* primo, *fine; FIFO(nodo*a=0, nodo*b=0){primo=a; fine=b;}};
- FIFO metti_fondo(FIFO a, nodo*b){
- if(!a.primo){
- a.primo=b;
- a.fine=a.primo;
- }else{
- a.fine->next=b;
- a.fine=a.fine->next;
- }
- return a;
- }
- nodo* togli(nodo* C,int y){
- if(!C) return 0;
- nodo*A=C;
- FIFO x;
- while(C){
- if(C->info==y){
- nodo*B=C->next;
- delete C;
- C=B;
- }else{
- x=metti_fondo(x,C);
- C=C->next;
- }
- }
- return x.primo;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement