Advertisement
Dambosin

ccccccccc

Mar 12th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. struct tstk {
  2. int inf;
  3. tstk *a;
  4. }*a, *b;
  5.  
  6. tstk *AddStask(tstk *sp, int inf) {
  7. tstk *spt = new tstk;
  8. spt->inf = inf;
  9. spt->a = sp;
  10. return spt;
  11. }
  12.  
  13. tstk *ReadStackD(tstk *sp, int &inf) {
  14. if (sp == NULL) return NULL;
  15. tstk *spt = sp;
  16. inf = sp->inf;
  17. sp = sp->a;
  18. delete spt;
  19. return sp;
  20. }
  21.  
  22. tstk *DelStackAll(tstk *sp) {
  23. tstk *spt; int inf;
  24. while (sp != NULL) {
  25. spt = sp;
  26. inf = sp->inf;
  27. sp = sp->a;
  28. delete spt;
  29. }
  30. return NULL;
  31. }
  32. void RevStackAfter(tstk *sp)
  33. {
  34. tstk *spt = sp->a->a;
  35. sp->a->a = spt->a;
  36. spt->a = sp->a;
  37. sp->a = spt;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement